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

Function generateZshCompletion

packages/cli/src/completions.ts:272–473  ·  view source on GitHub ↗
(commands: string[])

Source from the content-addressed store, hash-verified

270}
271
272function generateZshCompletion(commands: string[]): string {
273 const blockTypes = FILTERABLE_BLOCK_TYPES.join(' ')
274
275 // Build the commands array for zsh
276 const commandEntries = commands
277 .map(cmd => ` '${cmd}:${zshCommandDescriptions[cmd] ?? cmd}'`)
278 .concat(" 'help:Display help for command'")
279 .join('\n')
280
281 // Build the help subcommand completions
282 const helpCommands = commands.join(' ')
283
284 return `#compdef deepnote
285# Zsh completion for deepnote CLI
286# Add this to ~/.zshrc
287
288_deepnote() {
289 local -a commands
290 commands=(
291${commandEntries}
292 )
293
294 local -a global_options
295 global_options=(
296 '--help[Display help information]'
297 '-h[Display help information]'
298 '--version[Display the CLI version]'
299 '-v[Display the CLI version]'
300 '--no-color[Disable colored output]'
301 '--debug[Show debug information]'
302 '--quiet[Suppress non-essential output]'
303 '-q[Suppress non-essential output]'
304 )
305
306 _arguments -C \\
307 $global_options \\
308 '1: :->command' \\
309 '*:: :->args'
310
311 case $state in
312 command)
313 _describe -t commands 'deepnote commands' commands
314 ;;
315 args)
316 case $words[1] in
317 inspect)
318 _arguments \\
319 '(-o --output)'{-o,--output}'[Output format]:format:(json toon llm)' \\
320 '*:deepnote file:_files -g "*.deepnote"'
321 ;;
322 cat)
323 _arguments \\
324 '(-o --output)'{-o,--output}'[Output format]:format:(json llm)' \\
325 '--notebook[Show only blocks from specified notebook]:notebook name:' \\
326 '--type[Filter blocks by type]:type:(${blockTypes})' \\
327 '--tree[Show structure only without block content]' \\
328 '*:deepnote file:_files -g "*.deepnote"'
329 ;;

Callers 1

generateCompletionScriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected