···58completion files.
5960By default it will autodetect the shell type from the completion file extension,
61-but you may also specify it by passing one of `--bash`, `--fish`, or
62-`--zsh`. These flags apply to all paths listed after them (up until another
63shell flag is given). Each path may also have a custom installation name
64provided by providing a flag `--name NAME` before the path. If this flag is not
65provided, zsh completions will be renamed automatically such that `foobar.zsh`
···77 # explicit behavior
78 installShellCompletion --bash --name foobar.bash share/completions.bash
79 installShellCompletion --fish --name foobar.fish share/completions.fish
080 installShellCompletion --zsh --name _foobar share/completions.zsh
81 # implicit behavior
82- installShellCompletion share/completions/foobar.{bash,fish,zsh}
83 '';
84}
85```
···104 installShellCompletion --cmd foobar \
105 --bash <($out/bin/foobar --bash-completion) \
106 --fish <($out/bin/foobar --fish-completion) \
0107 --zsh <($out/bin/foobar --zsh-completion)
108 '';
109}
···58completion files.
5960By default it will autodetect the shell type from the completion file extension,
61+but you may also specify it by passing one of `--bash`, `--fish`, `--zsh`, or
62+`--nushell`. These flags apply to all paths listed after them (up until another
63shell flag is given). Each path may also have a custom installation name
64provided by providing a flag `--name NAME` before the path. If this flag is not
65provided, zsh completions will be renamed automatically such that `foobar.zsh`
···77 # explicit behavior
78 installShellCompletion --bash --name foobar.bash share/completions.bash
79 installShellCompletion --fish --name foobar.fish share/completions.fish
80+ installShellCompletion --nushell --name foobar share/completions.nu
81 installShellCompletion --zsh --name _foobar share/completions.zsh
82 # implicit behavior
83+ installShellCompletion share/completions/foobar.{bash,fish,zsh,nu}
84 '';
85}
86```
···105 installShellCompletion --cmd foobar \
106 --bash <($out/bin/foobar --bash-completion) \
107 --fish <($out/bin/foobar --fish-completion) \
108+ --nushell <($out/bin/foobar --nushell-completion) \
109 --zsh <($out/bin/foobar --zsh-completion)
110 '';
111}
+2
doc/release-notes/rl-2511.section.md
···8889- [`homebox` 0.20.0](https://github.com/sysadminsmedia/homebox/releases/tag/v0.20.0) changed how assets are stored and hashed. It is recommended to back up your database before this update.
900091- New hardening flags, `strictflexarrays1` and `strictflexarrays3` were made available, corresponding to the gcc/clang options `-fstrict-flex-arrays=1` and `-fstrict-flex-arrays=3` respectively.
9293- `gramps` has been updated to 6.0.0
···8889- [`homebox` 0.20.0](https://github.com/sysadminsmedia/homebox/releases/tag/v0.20.0) changed how assets are stored and hashed. It is recommended to back up your database before this update.
9091+- `installShellCompletion`: now supports Nushell completion files
92+93- New hardening flags, `strictflexarrays1` and `strictflexarrays3` were made available, corresponding to the gcc/clang options `-fstrict-flex-arrays=1` and `-fstrict-flex-arrays=3` respectively.
9495- `gramps` has been updated to 6.0.0
+12-7
pkgs/by-name/in/installShellFiles/setup-hook.sh
···51# installShellCompletion [--cmd <name>] ([--bash|--fish|--zsh] [--name <name>] <path>)...
52#
53# Each path is installed into the appropriate directory for shell completions for the given shell.
54-# If one of `--bash`, `--fish`, or `--zsh` is given the path is assumed to belong to that shell.
55-# Otherwise the file extension will be examined to pick a shell. If the shell is unknown a warning
56-# will be logged and the command will return a non-zero status code after processing any remaining
57-# paths. Any of the shell flags will affect all subsequent paths (unless another shell flag is
58-# given).
59#
60# If the shell completion needs to be renamed before installing the optional `--name <name>` flag
61# may be given. Any name provided with this flag only applies to the next path.
···84#
85# installShellCompletion --bash --name foobar.bash share/completions.bash
86# installShellCompletion --fish --name foobar.fish share/completions.fish
087# installShellCompletion --zsh --name _foobar share/completions.zsh
88#
89# Or to use shell newline escaping to split a single invocation across multiple lines:
···91# installShellCompletion --cmd foobar \
92# --bash <($out/bin/foobar --bash-completion) \
93# --fish <($out/bin/foobar --fish-completion) \
094# --zsh <($out/bin/foobar --zsh-completion)
95#
96# If any argument is `--` the remaining arguments will be treated as paths.
···100 # Parse arguments
101 if (( parseArgs )); then
102 case "$arg" in
103- --bash|--fish|--zsh)
104 shell=${arg#--}
105 continue;;
106 --name)
···146 elif [[ -p "$arg" ]]; then
147 # this is a named fd or fifo
148 if [[ -z "$curShell" ]]; then
149- nixErrorLog "${FUNCNAME[0]}: named pipe requires one of --bash, --fish, or --zsh"
150 return 1
151 elif [[ -z "$name" && -z "$cmdname" ]]; then
152 nixErrorLog "${FUNCNAME[0]}: named pipe requires one of --cmd or --name"
···161 case "$argbase" in
162 ?*.bash) curShell=bash;;
163 ?*.fish) curShell=fish;;
0164 ?*.zsh) curShell=zsh;;
165 *)
166 if [[ "$argbase" = _* && "$argbase" != *.* ]]; then
···182 elif [[ -n "$cmdname" ]]; then
183 case "$curShell" in
184 bash|fish) outName=$cmdname.$curShell;;
0185 zsh) outName=_$cmdname;;
186 *)
187 # Our list of shells is out of sync with the flags we accept or extensions we detect.
···193 case "$curShell" in
194 bash) sharePath=bash-completion/completions;;
195 fish) sharePath=fish/vendor_completions.d;;
0196 zsh)
197 sharePath=zsh/site-functions
198 # only apply automatic renaming if we didn't have a manual rename
···51# installShellCompletion [--cmd <name>] ([--bash|--fish|--zsh] [--name <name>] <path>)...
52#
53# Each path is installed into the appropriate directory for shell completions for the given shell.
54+# If one of `--bash`, `--fish`, `--zsh`, or `--nushell` is given the path is assumed to belong to
55+# that shell. Otherwise the file extension will be examined to pick a shell. If the shell is
56+# unknown a warning will be logged and the command will return a non-zero status code after
57+# processing any remaining paths. Any of the shell flags will affect all subsequent paths (unless
58+# another shell flag is given).
59#
60# If the shell completion needs to be renamed before installing the optional `--name <name>` flag
61# may be given. Any name provided with this flag only applies to the next path.
···84#
85# installShellCompletion --bash --name foobar.bash share/completions.bash
86# installShellCompletion --fish --name foobar.fish share/completions.fish
87+# installShellCompletion --nushell --name foobar share/completions.nu
88# installShellCompletion --zsh --name _foobar share/completions.zsh
89#
90# Or to use shell newline escaping to split a single invocation across multiple lines:
···92# installShellCompletion --cmd foobar \
93# --bash <($out/bin/foobar --bash-completion) \
94# --fish <($out/bin/foobar --fish-completion) \
95+# --nushell <($out/bin/foobar --nushell-completion)
96# --zsh <($out/bin/foobar --zsh-completion)
97#
98# If any argument is `--` the remaining arguments will be treated as paths.
···102 # Parse arguments
103 if (( parseArgs )); then
104 case "$arg" in
105+ --bash|--fish|--zsh|--nushell)
106 shell=${arg#--}
107 continue;;
108 --name)
···148 elif [[ -p "$arg" ]]; then
149 # this is a named fd or fifo
150 if [[ -z "$curShell" ]]; then
151+ nixErrorLog "${FUNCNAME[0]}: named pipe requires one of --bash, --fish, --zsh, or --nushell"
152 return 1
153 elif [[ -z "$name" && -z "$cmdname" ]]; then
154 nixErrorLog "${FUNCNAME[0]}: named pipe requires one of --cmd or --name"
···163 case "$argbase" in
164 ?*.bash) curShell=bash;;
165 ?*.fish) curShell=fish;;
166+ ?*.nu) curShell=nushell;;
167 ?*.zsh) curShell=zsh;;
168 *)
169 if [[ "$argbase" = _* && "$argbase" != *.* ]]; then
···185 elif [[ -n "$cmdname" ]]; then
186 case "$curShell" in
187 bash|fish) outName=$cmdname.$curShell;;
188+ nushell) outName=$cmdname.nu;;
189 zsh) outName=_$cmdname;;
190 *)
191 # Our list of shells is out of sync with the flags we accept or extensions we detect.
···197 case "$curShell" in
198 bash) sharePath=bash-completion/completions;;
199 fish) sharePath=fish/vendor_completions.d;;
200+ nushell) sharePath=nushell/vendor/autoload;;
201 zsh)
202 sharePath=zsh/site-functions
203 # only apply automatic renaming if we didn't have a manual rename