feat: add bash and zsh shell completions (#29) - #38
Merged
Conversation
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gander completion {bash|zsh}subcommand that prints a shell completion script to stdout. Scripts live undercompletions/and are embedded viago:embed— no filesystem lookup at runtime.signup,share,remove,list,completion,--upgrade) and render flag, including sub-flags such assignup --email/--force,share --watch,remove --all/--pick/--yes/--non-interactive, andcompletion {bash|zsh}.gander-completions.tar.gzon every tagged release.After install, users can add:
Related Issue
Closes #29
Testing
completion_test.gocovers: bash + zsh output is non-empty, expected tokens are present, unknown shells reject, no-arg rejects, andbash -n/zsh -nparse-check the generated scripts.go vet ./...,go test ./...,CGO_ENABLED=0 go build ./...all clean.gander --helpshows the new subcommand;gander completion bash | bash -nand the zsh equivalent both pass on this machine.Notes
cobraor similar — completion logic is a hand-written table for transparency.