···5858completion files.
59596060By default it will autodetect the shell type from the completion file extension,
6161-but you may also specify it by passing one of `--bash`, `--fish`, or
6262-`--zsh`. These flags apply to all paths listed after them (up until another
6161+but you may also specify it by passing one of `--bash`, `--fish`, `--zsh`, or
6262+`--nushell`. These flags apply to all paths listed after them (up until another
6363shell flag is given). Each path may also have a custom installation name
6464provided by providing a flag `--name NAME` before the path. If this flag is not
6565provided, zsh completions will be renamed automatically such that `foobar.zsh`
···7777 # explicit behavior
7878 installShellCompletion --bash --name foobar.bash share/completions.bash
7979 installShellCompletion --fish --name foobar.fish share/completions.fish
8080+ installShellCompletion --nushell --name foobar share/completions.nu
8081 installShellCompletion --zsh --name _foobar share/completions.zsh
8182 # implicit behavior
8282- installShellCompletion share/completions/foobar.{bash,fish,zsh}
8383+ installShellCompletion share/completions/foobar.{bash,fish,zsh,nu}
8384 '';
8485}
8586```
···104105 installShellCompletion --cmd foobar \
105106 --bash <($out/bin/foobar --bash-completion) \
106107 --fish <($out/bin/foobar --fish-completion) \
108108+ --nushell <($out/bin/foobar --nushell-completion) \
107109 --zsh <($out/bin/foobar --zsh-completion)
108110 '';
109111}
+2
doc/release-notes/rl-2511.section.md
···88888989- [`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.
90909191+- `installShellCompletion`: now supports Nushell completion files
9292+9193- 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.
92949395- `gramps` has been updated to 6.0.0
+12-7
pkgs/by-name/in/installShellFiles/setup-hook.sh
···5151# installShellCompletion [--cmd <name>] ([--bash|--fish|--zsh] [--name <name>] <path>)...
5252#
5353# Each path is installed into the appropriate directory for shell completions for the given shell.
5454-# If one of `--bash`, `--fish`, or `--zsh` is given the path is assumed to belong to that shell.
5555-# Otherwise the file extension will be examined to pick a shell. If the shell is unknown a warning
5656-# will be logged and the command will return a non-zero status code after processing any remaining
5757-# paths. Any of the shell flags will affect all subsequent paths (unless another shell flag is
5858-# given).
5454+# If one of `--bash`, `--fish`, `--zsh`, or `--nushell` is given the path is assumed to belong to
5555+# that shell. Otherwise the file extension will be examined to pick a shell. If the shell is
5656+# unknown a warning will be logged and the command will return a non-zero status code after
5757+# processing any remaining paths. Any of the shell flags will affect all subsequent paths (unless
5858+# another shell flag is given).
5959#
6060# If the shell completion needs to be renamed before installing the optional `--name <name>` flag
6161# may be given. Any name provided with this flag only applies to the next path.
···8484#
8585# installShellCompletion --bash --name foobar.bash share/completions.bash
8686# installShellCompletion --fish --name foobar.fish share/completions.fish
8787+# installShellCompletion --nushell --name foobar share/completions.nu
8788# installShellCompletion --zsh --name _foobar share/completions.zsh
8889#
8990# Or to use shell newline escaping to split a single invocation across multiple lines:
···9192# installShellCompletion --cmd foobar \
9293# --bash <($out/bin/foobar --bash-completion) \
9394# --fish <($out/bin/foobar --fish-completion) \
9595+# --nushell <($out/bin/foobar --nushell-completion)
9496# --zsh <($out/bin/foobar --zsh-completion)
9597#
9698# If any argument is `--` the remaining arguments will be treated as paths.
···100102 # Parse arguments
101103 if (( parseArgs )); then
102104 case "$arg" in
103103- --bash|--fish|--zsh)
105105+ --bash|--fish|--zsh|--nushell)
104106 shell=${arg#--}
105107 continue;;
106108 --name)
···146148 elif [[ -p "$arg" ]]; then
147149 # this is a named fd or fifo
148150 if [[ -z "$curShell" ]]; then
149149- nixErrorLog "${FUNCNAME[0]}: named pipe requires one of --bash, --fish, or --zsh"
151151+ nixErrorLog "${FUNCNAME[0]}: named pipe requires one of --bash, --fish, --zsh, or --nushell"
150152 return 1
151153 elif [[ -z "$name" && -z "$cmdname" ]]; then
152154 nixErrorLog "${FUNCNAME[0]}: named pipe requires one of --cmd or --name"
···161163 case "$argbase" in
162164 ?*.bash) curShell=bash;;
163165 ?*.fish) curShell=fish;;
166166+ ?*.nu) curShell=nushell;;
164167 ?*.zsh) curShell=zsh;;
165168 *)
166169 if [[ "$argbase" = _* && "$argbase" != *.* ]]; then
···182185 elif [[ -n "$cmdname" ]]; then
183186 case "$curShell" in
184187 bash|fish) outName=$cmdname.$curShell;;
188188+ nushell) outName=$cmdname.nu;;
185189 zsh) outName=_$cmdname;;
186190 *)
187191 # Our list of shells is out of sync with the flags we accept or extensions we detect.
···193197 case "$curShell" in
194198 bash) sharePath=bash-completion/completions;;
195199 fish) sharePath=fish/vendor_completions.d;;
200200+ nushell) sharePath=nushell/vendor/autoload;;
196201 zsh)
197202 sharePath=zsh/site-functions
198203 # only apply automatic renaming if we didn't have a manual rename