-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(cli): reusable command options
- Loading branch information
1 parent
36f8b5b
commit 2235c6d
Showing
11 changed files
with
81 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
|
||
<resources> | ||
<string name="key1">value1</string> | ||
<string name="key2">value2</string> | ||
</resources> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
|
||
<resources> | ||
<string name="key1">value1</string> | ||
<string name="key2">value2</string> | ||
</resources> | ||
<resources> | ||
<string name="key1">value1</string> | ||
<string name="key2">value2</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
<resources> | ||
<string name="key1">Value1</string> | ||
<string name="key2">Value2</string> | ||
<string name="kkk">vvvv</string> | ||
<resources></resources> | ||
<string name="key3">Value3</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ yargs(hideBin(process.argv)) | |
.usage('$0 <cmd> [args]') | ||
// @ts-ignore | ||
.command(commands) | ||
.help().argv; | ||
.help(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { Argv } from 'yargs'; | ||
|
||
export function directionOption(argv: Argv) { | ||
return argv.option('direction', { | ||
alias: 'd', | ||
desc: 'Direction of key sort', | ||
type: 'string', | ||
default: 'asc', | ||
choices: ['asc', 'desc'] | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import type { Argv } from 'yargs'; | ||
|
||
export function keyValueOptions(argv: Argv, action: string) { | ||
return argv | ||
.option('key', { | ||
alias: 'k', | ||
desc: `Key of ${action} string`, | ||
type: 'string' | ||
}) | ||
.option('value', { | ||
alias: 'v', | ||
desc: `Value of ${action} string`, | ||
type: 'string' | ||
}); | ||
} | ||
|
||
export function oldKeyOrValueOptions(argv: Argv) { | ||
return argv | ||
.option('oldValue', { | ||
alias: 'o', | ||
desc: 'Old key or value of update string', | ||
demandOption: true, | ||
type: 'string' | ||
}) | ||
.option('newValue', { | ||
alias: 'n', | ||
desc: 'New key or value of update string', | ||
demandOption: true, | ||
type: 'string' | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { Argv } from 'yargs'; | ||
|
||
export function pathOption(argv: Argv) { | ||
return argv.option('path', { | ||
alias: 'p', | ||
desc: 'Path of file or directory to adding string', | ||
demandOption: true, | ||
type: 'string', | ||
default: process.cwd() | ||
}); | ||
} |