forked from nix-community/nix-zsh-completions
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_nix-shell
35 lines (30 loc) · 952 Bytes
/
_nix-shell
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#compdef nix-shell
#autoload
_nix-common-options
local -a _nix_shell_opts
_nix_shell_opts=(
'--command[Run a command instead of starting an interactive shell]:Command:_command_names' \
'--exclude[Do not build any dependencies which match this regex]:Regex:( )' \
'--pure[Clear the environment before starting the interactive shell]' \
)
local norm_arguments='*:Paths:_nix_path'
local word
for word in $words; do
case "$word" in
--packages|-[^-]#p[^-]#)
norm_arguments='*:Packages: _nix_attr_paths "import <nixpkgs>"'
break
;;
--expr|-[^-]#E[^-]#)
norm_arguments='*:Expression:'
;;
esac
done
_arguments \
$_nix_boilerplate_opts \
$_nix_common_opts \
$_nix_shell_opts \
$norm_arguments \
+ '(group)' \
{--packages,-p}'[Set up an environment where the given packages are present]' \
{--expr,-E}'[Interpret command line args as Nix expressions]'\