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

Generic shell completion support for the 'nix' command #3587

Merged
merged 11 commits into from May 12, 2020
Merged

Conversation

@edolstra
Copy link
Member

edolstra commented May 11, 2020

This adds completion support for the nix command. For example:

$ nix build nixpkgs#thunderb<TAB>
nixpkgs#thunderbird      nixpkgs#thunderbird-bin  nixpkgs#thunderbolt

This is mostly shell-independent: the bash completion script just runs the nix command with the environment variable NIX_GET_COMPLETIONS set. nix then prints the completions on stdout. So it shouldn't be hard to enable support for other shells.

Any flag / argument can get custom completion by setting a completer function.

edolstra added 11 commits May 10, 2020
This completes flakerefs using the registry (e.g. 'nix<TAB>' => 'nix
nixpkgs') and flake output attributes by evaluating the flake
(e.g. 'dwarffs#nix<TAB>' => 'dwarffs#nixosModules').
macOS doesn't have GLOB_ONLYDIR.
@edolstra edolstra merged commit 215f09d into flakes May 12, 2020
4 checks passed
4 checks passed
tests (ubuntu-18.04)
Details
tests (ubuntu-18.04)
Details
tests (macos)
Details
tests (macos)
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.