Skip to content

feat: shell completions — bash, zsh and fish (v1.7.0) #79

Description

@shouze

Context

Part of the 🛠 Developer experience EPIC #77, targeting v1.7.0.

Goal

Add a completions subcommand that outputs a shell completion script for bash, zsh or fish.

Users install once:

# bash (~/.bashrc)
eval "$(github-code-search completions --shell bash)"

# zsh (~/.zshrc)
eval "$(github-code-search completions --shell zsh)"

# fish (~/.config/fish/config.fish)
github-code-search completions --shell fish | source

When --shell is omitted, the shell is auto-detected from $SHELL.

Scope

  • New completions subcommand in github-code-search.ts
  • Completion scripts as inline templates (no new runtime dependency)
  • Covers subcommands: query, upgrade, completions
  • Covers common options: --org, --format, --output-type, --exclude-repositories, --exclude-extracts, --group-by-team-prefix, --no-interactive, --include-archived, --no-cache
  • TDD: unit tests that verify the output is a non-empty string containing the tool name for each shell

Acceptance criteria

  • github-code-search completions --shell bash → valid bash script
  • github-code-search completions --shell zsh → valid zsh script
  • github-code-search completions --shell fish → valid fish script
  • Auto-detection from $SHELL (fish/zsh/bash)
  • Unknown shell → friendly error message + exit 1
  • Unit tests pass

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions