Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usage: shell completions #24

Open
1 task done
water-sucks opened this issue Aug 2, 2024 · 1 comment · May be fixed by #50
Open
1 task done

usage: shell completions #24

water-sucks opened this issue Aug 2, 2024 · 1 comment · May be fixed by #50
Assignees
Labels
enhancement New feature or request

Comments

@water-sucks
Copy link
Owner

Feature Description

Shell completion is sorely missed from this tool; other NixOS tooling has it, whether it is manually written out-of-tree a la https://github.com/nix-community/nix-zsh-completions, or inside the repo, or something else.

This will help quite a lot with discoverability for new users, and just for ease of use. No one wants to memorize generation numbers or run nixos generation list first to see what generation to switch to, that's just annoying. Completions will help with this matter.

Instead of building these completions manually for each shell (there's a lot of commands and options, after all!), we should attempt to implement this in the Nix way, where possible completions for a command are returned on stdout after invoking the actual command itself in completion mode (using an env var like NIXOS_CLI_COMPLETION_INDEX or something like that), and go from there. This will allow us to reuse logic between the command itself and completions, without reimplementing it for each shell that requests it.

Help

Yes

Issues

  • I have checked existing issues and there are no existing ones with the same request.
@water-sucks water-sucks added the enhancement New feature or request label Aug 2, 2024
@water-sucks water-sucks self-assigned this Aug 2, 2024
@water-sucks
Copy link
Owner Author

water-sucks commented Jan 1, 2025

This will be worked on during the rewrite; cobra has stellar support for command-line completions, so it's easy enough to work on during the rewrite effort.

@water-sucks water-sucks linked a pull request Jan 12, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant