1
0
mirror of https://github.com/bitwarden/cli synced 2025-12-16 16:23:30 +00:00

add completion generation for zsh (#137)

This commit is contained in:
Munif Tanjim
2020-05-26 19:17:41 +06:00
committed by GitHub
parent 3d11b635d8
commit 723ff201f6
2 changed files with 157 additions and 0 deletions

View File

@@ -21,6 +21,8 @@ import { ShareCommand } from './commands/share.command';
import { SyncCommand } from './commands/sync.command';
import { UnlockCommand } from './commands/unlock.command';
import { CompletionCommand } from './commands/completion.command';
import { LogoutCommand } from 'jslib/cli/commands/logout.command';
import { UpdateCommand } from 'jslib/cli/commands/update.command';
@@ -660,6 +662,26 @@ export class Program extends BaseProgram {
this.processResponse(response);
});
program
.command('completion')
.description('Generate shell completions.')
.option('--shell <shell>', 'Shell to generate completions for.')
.on('--help', () => {
writeLn('\n Notes:');
writeLn('');
writeLn(' Valid shells are `zsh`.')
writeLn('');
writeLn(' Examples:');
writeLn('');
writeLn(' bw completion --shell zsh');
writeLn('', true);
})
.action(async (cmd: program.Command) => {
const command = new CompletionCommand();
const response = await command.run(cmd);
this.processResponse(response);
})
program
.parse(process.argv);