We now correctly recognise ‘guix -Abcdef’ as equivalent to ‘guix -f’.
* etc/completion/bash/guix (_guix_is_short_option, guix_is_long_option):
New functions.
(_guix_is_dash_f, _guix_is_dash_l, _guix_is_dash_L, _guix_is_dash_m)
(_guix_is_dash_C, _guix_is_dash_p): Use them.
Fixes, for example, "guix import pypi --<TAB>", which would previously
fail to show '--recursive'.
* etc/completion/bash/guix (_guix_complete_option): Fix options
completion for first subcommand.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* etc/completion/bash/guix
(_guix_complete_available_package_or_store_file): New function.
(_guix_complete): Call it in place of _guix_complete_available_package
after the ‘build’ command.
_guix_complete is always called with a fresh empty array.
* etc/completion/bash/guix (_guix_complete_command)
(_guix_complete_subcommand, _guix_complete_installed_package)
(_guix_complete_option, _guix_complete_pid): Append to $COMPREPLY rather
than re-assigning.
Note that there are still plenty of bugs that this series didn't fix,
e.g.:
$ guix time-machine -- system reconf<Tab>
* etc/completion/bash/guix (_guix_complete): Call _guix_complete_option
if the word at point looks like an option.
* etc/completion/bash/guix (_guix_complete_option): Receive two
arguments and complete the second based on the first, instead
of blindly completing the very last word based on the very first
(sub)command.
(_guix_complete): Adjust both calls.
* etc/completion/bash/guix (_guix_is_option): New function.
(_guix_is_command): Remove function to replace it with simple string
comparison…
(_guix_complete): …here. Complete the ‘innermost’ command at point.
This is a followup to 3794ce93be, which
broke command completion.
Reported by Oleg Pykhalov <go.wigust@gmail.com>.
* etc/completion/bash/guix (_guix_complete_command): Update to match
output of 'guix help' as introduced in
3794ce93be.
Commit 538ca8dd65 introduced a second
'_guix_complete_subcommand' function, shadowing the existing one, which
broke sub-command completion for 'guix system', 'guix import', etc.
* etc/completion/bash/guix: Distinguish between '_guix_complete_command'
and '_guix_complete_subcommand'. Adjust users to call the right one.
* etc/completion/bash/guix (_guix_complete_subcommand): New function.
(_guix_complete): Use it. For "time-machine", call
'_guix_complete_subcommand' by default.
* etc/completion/bash/guix (_guix_is_dash_C, _guix_is_dash_p): New functions.
(_guix_complete): Honor them for "install", "remove", "upgrade", "pull",
and "time-machine".
* guix/scripts/build.scm (show-help): Document --manifest argument.
(options->things-to-build): When given a manifest, evaluate all the entries.
* tests/guix-build.sh: Add test for --manifest.
* doc/guix.texi (Additional Build Options): Mention --manifest.
* etc/completion/bash/guix: Complete file name if 'guix build' argument is
-m.
Fixes a regression introduced in
9b0a755f64 whereby 'guix build TAB' would
not suggest any completion.
* etc/completion/bash/guix (_guix_complete): Arrange so 'guix build TAB'
completes available packages.
Reported by a couple of cool folks at a bar in Brussels.
* etc/completion/bash/guix (_guix_complete): Use '_guix_complete_file'
for 'guix gc'. This fixes completion of 'guix gc -d'.
* etc/completion/bash/guix (_guix_complete_subcommand): New function.
(_guix_complete_option): Allow completion of subcommand options.
(_guix_complete): Use '_guix_complete_subcommand' for "system" and
"import".
This avoids spurious messages when pressing TAB.
* etc/completion/bash/guix (_guix_complete_available_package)
(_guix_complete_installed_package, _guix_complete_option)
(_guix_complete): Redirect stderr to /dev/null when running 'guix'.
* etc/completion/bash/guix (_guix_complete_available_package): Cache the list
of available packages in '_guix_available_packages' and use it.
(_guix_complete): Cache the list of subcommands in '_guix_subcommands' and
use it.