diff options
author | Lily Ballard <lilyball@twitch.tv> | 2020-03-28 14:55:06 -0700 |
---|---|---|
committer | Lily Ballard <lily@sb.org> | 2020-10-08 15:08:40 -0700 |
commit | 7e1e8543fce20baafd76b7b45d8f36a47d41090e (patch) | |
tree | a65fb3146693a9690015651773c5f738088736dd /doc/stdenv | |
parent | 506a936e5f22786158e2a50408c697c050bc61ed (diff) |
installShellFiles: Enhance installShellCompletion
Teach installShellCompletion how to install completions from a named
pipe. Also add a convenience flag `--cmd NAME` that synthesizes the name
for each completion instead of requiring repeated `--name` flags.
Usage looks something like
installShellCompletion --cmd foobar \
--bash <($out/bin/foobar --bash-completion) \
--fish <($out/bin/foobar --fish-completion) \
--zsh <($out/bin/foobar --zsh-completion)
Fixes #83284
Diffstat (limited to 'doc/stdenv')
-rw-r--r-- | doc/stdenv/stdenv.xml | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/doc/stdenv/stdenv.xml b/doc/stdenv/stdenv.xml index 4c069b57edd7..46ee97927eac 100644 --- a/doc/stdenv/stdenv.xml +++ b/doc/stdenv/stdenv.xml @@ -2070,7 +2070,7 @@ nativeBuildInputs = [ breakpointHook ]; The <literal>installManPage</literal> function takes one or more paths to manpages to install. The manpages must have a section suffix, and may optionally be compressed (with <literal>.gz</literal> suffix). This function will place them into the correct directory. </para> <para> - The <literal>installShellCompletion</literal> function takes one or more paths to shell completion files. By default it will autodetect the shell type from the completion file extension, but you may also specify it by passing one of <literal>--bash</literal>, <literal>--fish</literal>, or <literal>--zsh</literal>. These flags apply to all paths listed after them (up until another shell flag is given). Each path may also have a custom installation name provided by providing a flag <literal>--name NAME</literal> before the path. If this flag is not provided, zsh completions will be renamed automatically such that <literal>foobar.zsh</literal> becomes <literal>_foobar</literal>. + The <literal>installShellCompletion</literal> function takes one or more paths to shell completion files. By default it will autodetect the shell type from the completion file extension, but you may also specify it by passing one of <literal>--bash</literal>, <literal>--fish</literal>, or <literal>--zsh</literal>. These flags apply to all paths listed after them (up until another shell flag is given). Each path may also have a custom installation name provided by providing a flag <literal>--name NAME</literal> before the path. If this flag is not provided, zsh completions will be renamed automatically such that <literal>foobar.zsh</literal> becomes <literal>_foobar</literal>. A root name may be provided for all paths using the flag <literal>--cmd NAME</literal>; this synthesizes the appropriate name depending on the shell (e.g. <literal>--cmd foo</literal> will synthesize the name <literal>foo.bash</literal> for bash and <literal>_foo</literal> for zsh). The path may also be a fifo or named fd (such as produced by <literal><(cmd)</literal>), in which case the shell and name must be provided. <programlisting> nativeBuildInputs = [ installShellFiles ]; postInstall = '' @@ -2081,6 +2081,11 @@ postInstall = '' installShellCompletion --zsh --name _foobar share/completions.zsh # implicit behavior installShellCompletion share/completions/foobar.{bash,fish,zsh} + # using named fd + installShellCompletion --cmd foobar \ + --bash <($out/bin/foobar --bash-completion) \ + --fish <($out/bin/foobar --fish-completion) \ + --zsh <($out/bin/foobar --zsh-completion) ''; </programlisting> </para> |