Skip to content

Commit efb5711

Browse files
authored
Merge pull request #125 from launchcodedev/bash-completions
Adds bash completions cli command
2 parents 24111b9 + a211942 commit efb5711

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

app-config-cli/src/index.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,31 @@ export const cli = yargs
354354
.group('verbose', OptionGroups.Logging)
355355
.group('quiet', OptionGroups.Logging)
356356
.group('silent', OptionGroups.Logging)
357+
.command(
358+
subcommand(
359+
{
360+
name: ['completion [shell]', 'completions [shell]'],
361+
description: 'Prints bash completions',
362+
examples: [
363+
['<(source $0 completion bash)', 'Adds bash completions, put this in your bashrc'],
364+
],
365+
positional: {
366+
shell: {
367+
type: 'string',
368+
demandOption: false,
369+
default: 'bash',
370+
},
371+
},
372+
},
373+
async ({ shell }) => {
374+
if (shell !== 'bash') {
375+
throw new AppConfigError('Only bash autocompletions are available');
376+
}
377+
378+
yargs.showCompletionScript();
379+
},
380+
),
381+
)
357382
.command(
358383
subcommand(
359384
{

0 commit comments

Comments
 (0)