Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ Create and manage biological identities (BEOs), institutional entities (IEOs), c
npm install -g bspctl
```

### Shell completions

After installing, add completions to your shell:

```bash
# bash — add to ~/.bashrc
eval "$(bsp completions bash)"

# zsh — add to ~/.zshrc
eval "$(bsp completions zsh)"
```

Or run without installing:

```bash
Expand Down
12 changes: 12 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,16 @@ registerIEOCommands(program)
registerExchangeCommands(program)
registerConfigCommands(program)

program
.command('completions [shell]')
.description('Print shell completion script (bash|zsh). Usage: eval "$(bsp completions bash)"')
.action((shell = 'bash') => {
const cmds = ['beo', 'ieo', 'consent', 'record', 'config', 'completions']
if (shell === 'zsh') {
console.log(`compdef '_arguments "1: :(${cmds.join(' ')})"' bsp`)
} else {
console.log(`complete -W "${cmds.join(' ')}" bsp`)
}
})

program.parse()
Loading