{"record":{"id":"237583bad0248fa9","repo":"jackwener/OpenCLI","slug":"unsupported-shell","errorCode":"UNSUPPORTED_SHELL","errorMessage":"Unsupported shell: ${shell}. Supported: bash, zsh, fish","messagePattern":"Unsupported shell: (.+?)\\. Supported: bash, zsh, fish","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"src/completion.ts","lineNumber":80,"sourceCode":"\n// ── Shell script generators ────────────────────────────────────────────────\n\n/**\n * Print the completion script for the requested shell.\n */\nexport function printCompletionScript(shell: string): void {\n  switch (shell) {\n    case 'bash':\n      process.stdout.write(bashCompletionScript());\n      break;\n    case 'zsh':\n      process.stdout.write(zshCompletionScript());\n      break;\n    case 'fish':\n      process.stdout.write(fishCompletionScript());\n      break;\n    default:\n      throw new CliError('UNSUPPORTED_SHELL', `Unsupported shell: ${shell}. Supported: bash, zsh, fish`);\n  }\n}\n","sourceCodeStart":62,"sourceCodeEnd":83,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/src/completion.ts#L62-L83","documentation":"printCompletionScript generates shell completion scripts for bash, zsh, and fish only. A request for any other shell (or an unrecognized value) throws a CliError with code UNSUPPORTED_SHELL. The error is thrown from the default branch of the shell switch before any script is emitted.","triggerScenarios":"opencli completion powershell; opencli completion sh; opencli completion BASH (case-sensitive match); passing an unset/empty shell variable so the default branch is hit.","commonSituations":"Users of PowerShell, cmd, nushell, or tcsh asking for completions; scripts reading $SHELL which may report /bin/sh or an unsupported shell; setting the shell argument with different capitalization.","solutions":["Request one of the supported shells explicitly: bash, zsh, or fish (lowercase).","For unsupported shells, use the closest supported script or a community completion solution.","In scripts, detect the shell from $SHELL basename and map unsupported shells to an error/alternative before calling the completion command."],"exampleFix":"// before\nopencli completion powershell\n// after\nopencli completion zsh  # or bash / fish","handlingStrategy":"validation","validationCode":"const SUPPORTED = ['bash', 'zsh', 'fish'] as const;\nconst shell = process.env.SHELL?.split('/').pop() ?? '';\nif (!SUPPORTED.includes(shell as any)) {\n  throw new Error(`Shell '${shell}' unsupported; use bash, zsh, or fish`);\n}","typeGuard":"type SupportedShell = 'bash' | 'zsh' | 'fish';\nconst isSupportedShell = (s: unknown): s is SupportedShell =>\n  s === 'bash' || s === 'zsh' || s === 'fish';","tryCatchPattern":"try {\n  opencli.completion(shell);\n} catch (e) {\n  if (e.code === 'UNSUPPORTED_SHELL') {\n    console.error(`${e.message}; generate for bash/zsh/fish instead.`);\n  } else throw e;\n}","preventionTips":["Only request bash, zsh, or fish, in lowercase.","Derive the shell from $SHELL basename and guard unsupported values.","For PowerShell/nushell, use their native completion mechanisms instead."],"tags":["cli","shell-completion","unsupported-shell"],"backgroundTag":"unsupported-shell","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}