Skip to content

feat: add bash and zsh shell completions (#29) - #38

Merged
scott merged 1 commit into
mainfrom
feat/29-shell-completions
Aug 17, 2026
Merged

feat: add bash and zsh shell completions (#29)#38
scott merged 1 commit into
mainfrom
feat/29-shell-completions

Conversation

@scott

@scott scott commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • New gander completion {bash|zsh} subcommand that prints a shell completion script to stdout. Scripts live under completions/ and are embedded via go:embed — no filesystem lookup at runtime.
  • Both scripts cover every current subcommand (signup, share, remove, list, completion, --upgrade) and render flag, including sub-flags such as signup --email/--force, share --watch, remove --all/--pick/--yes/--non-interactive, and completion {bash|zsh}.
  • The release workflow bundles the completions directory as gander-completions.tar.gz on every tagged release.
  • README gains a "Shell completions" subsection with sourcing examples and updates the Subcommands block.

After install, users can add:

source <(gander completion bash)     # bash
eval "$(gander completion zsh)"      # zsh

Related Issue

Closes #29

Testing

  • New completion_test.go covers: bash + zsh output is non-empty, expected tokens are present, unknown shells reject, no-arg rejects, and bash -n / zsh -n parse-check the generated scripts.
  • go vet ./..., go test ./..., CGO_ENABLED=0 go build ./... all clean.
  • Manual smoke: gander --help shows the new subcommand; gander completion bash | bash -n and the zsh equivalent both pass on this machine.

Notes

  • Fish and PowerShell completions were intentionally deferred to a future issue once the Windows build lands (ci: add windows-amd64 and windows-arm64 to release matrix #31). Bash + zsh cover the majority of the install base today.
  • No new dependency on cobra or similar — completion logic is a hand-written table for transparency.

- New 'gander completion {bash|zsh}' subcommand that emits a shell
  completion script to stdout. The scripts are stored under
  completions/ and embedded into the binary via go:embed — no
  filesystem lookup at runtime.
- Completions cover every current subcommand (signup, share, remove,
  list, completion, --upgrade) and render flag, including sub-flags
  like signup --email/--force, share --watch, remove --all/--pick/--yes/
  --non-interactive, and completion {bash|zsh}.
- The release workflow now bundles the completions directory as
  gander-completions.tar.gz on every tagged release.
- README adds a 'Shell completions' subsection and lists the new
  subcommand in the Subcommands block.
@scott
scott merged commit edaaacc into main Aug 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add shell completions (bash, zsh)

1 participant