Skip to content

Commit b2057f9

Browse files
authored
adds version and help short hand arguments (#2144)
1 parent bd4ff4d commit b2057f9

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

.changeset/honest-ducks-act.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@aws-amplify/backend-cli': minor
3+
---
4+
5+
adds shorthand argument for version and help

packages/cli/src/main_parser_factory.test.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,22 @@ void describe('main parser', { concurrency: false }, () => {
1717
assert.match(output, /generate\s+Generates post deployment artifacts/);
1818
});
1919

20-
void it('shows version', async () => {
20+
void it('includes generate command in shorthand help output', async () => {
21+
const output = await commandRunner.runCommand('-h');
22+
assert.match(output, /Commands:/);
23+
assert.match(output, /generate\s+Generates post deployment artifacts/);
24+
});
25+
26+
void it('shows version for long version option', async () => {
2127
const output = await commandRunner.runCommand('--version');
2228
assert.equal(output, `${version}\n`);
2329
});
2430

31+
void it('shows version for shorthand version option', async () => {
32+
const output = await commandRunner.runCommand('-v');
33+
assert.equal(output, `${version}\n`);
34+
});
35+
2536
void it('prints help if command is not provided', async () => {
2637
await assert.rejects(
2738
() => commandRunner.runCommand(''),

packages/cli/src/main_parser_factory.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ export const createMainParser = (libraryVersion: string): Argv => {
2929
.command(createConfigureCommand())
3030
.command(createInfoCommand())
3131
.help()
32+
.alias('h', 'help')
33+
.alias('v', 'version')
3234
.demandCommand()
3335
.strictCommands()
3436
.recommendCommands()

0 commit comments

Comments
 (0)