MCPcopy Create free account
hub / github.com/deepnote/deepnote / generateCompletionScript

Function generateCompletionScript

packages/cli/src/completions.ts:7–20  ·  view source on GitHub ↗
(shell: string, program: Command)

Source from the content-addressed store, hash-verified

5 * Generate shell completion script for the given shell.
6 */
7export function generateCompletionScript(shell: string, program: Command): string | null {
8 const commands = program.commands.map(cmd => cmd.name()).filter(name => name !== 'help')
9
10 switch (shell.toLowerCase()) {
11 case 'bash':
12 return generateBashCompletion(commands)
13 case 'zsh':
14 return generateZshCompletion(commands)
15 case 'fish':
16 return generateFishCompletion(commands)
17 default:
18 return null
19 }
20}
21
22function generateBashCompletion(commands: string[]): string {
23 const blockTypes = FILTERABLE_BLOCK_TYPES.join(' ')

Callers 1

registerCommandsFunction · 0.90

Calls 3

generateBashCompletionFunction · 0.85
generateZshCompletionFunction · 0.85
generateFishCompletionFunction · 0.85

Tested by

no test coverage detected