Commit graph

29 commits

Author SHA1 Message Date
Tobias Geerinckx-Rice 17f76b209c
bash completion: Append to $COMPREPLY where possible.
_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.
2021-10-03 19:23:48 +02:00
Tobias Geerinckx-Rice 6fba67df19
bash completion: Consolidate similar $command ‘if’ branches.
* etc/completion/bash/guix (_guix_complete): Combine the ‘upgrade’ and
‘remove’ commands, as well as ‘download’, ‘gc’, and ‘hash’.
2021-10-03 19:23:48 +02:00
Tobias Geerinckx-Rice fa0dc1229c
bash_completion: Complete options for ‘guix environment’.
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.
2021-06-16 12:13:39 +02:00
Tobias Geerinckx-Rice dc3ba8c836
bash completion: Complete options for the right command.
* 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.
2021-06-16 12:13:39 +02:00
Tobias Geerinckx-Rice 80a17aae79
bash completion: Really support subcommands.
* 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.
2021-06-16 12:13:39 +02:00
Ludovic Courtès 611ae310f4
bash completion: Complete file names after '-f' and '-l'.
* etc/completion/bash/guix (_guix_is_dash_f, _guix_is_dash_l): New
functions.
(_guix_complete): Complete file names after 'guix package -f', 'guix
build -f', and 'guix environment -l'.
2020-12-04 23:45:08 +01:00
Ludovic Courtès 8e0c5033b1
bash completion: Adjust to new 'guix help' output.
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.
2020-09-24 17:53:02 +02:00
Fulbert 92951bf46c
bash completion: Complete file names after 'guix package -p'.
* etc/completion/bash/guix (_guix_complete): Add _guix_is_dash_p.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-09-21 23:33:49 +02:00
Ludovic Courtès 2ba81afcc2
bash completion: Restore completion for 'guix system', etc.
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.
2020-09-10 12:27:24 +02:00
Ludovic Courtès 4b4f890cb0
bash completion: Complete 'guix environment' properly.
* etc/completion/bash/guix (_guix_complete): Add case for "guix environment".
2020-06-27 23:42:20 +02:00
Ludovic Courtès 538ca8dd65
bash completion: Complete sub-commands after 'guix time-machine'.
* etc/completion/bash/guix (_guix_complete_subcommand): New function.
(_guix_complete): Use it.  For "time-machine", call
'_guix_complete_subcommand' by default.
2020-06-04 23:26:43 +02:00
Ludovic Courtès b7bb381ba3
bash completion: Complete file names after '-p' and '-C'.
* 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".
2020-06-04 23:26:43 +02:00
Marius Bakke 11415d3506
guix build: Add '--manifest' option.
* 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.
2020-02-14 17:49:26 +01:00
Ludovic Courtès d824cfbabe
guix package: Add 'install', 'remove', and 'upgrade' aliases.
* guix/scripts/install.scm, guix/scripts/remove.scm,
guix/scripts/upgrade.scm, tests/guix-package-aliases.sh: New files.
* Makefile.am (MODULES, SH_TESTS): Add them.
* po/guix/POTFILES.in: Add them.
* guix/scripts/package.scm (guix-package): Split with...
(guix-package*): ... this.  New procedure.
* doc/guix.texi (Invoking guix package): Document them.
(Binary Installation, Application Setup, Package Management)
(Packages with Multiple Outputs, Package Modules)
(X.509 Certificates, Installing Debugging Files): Use 'guix install' in
simple examples.
* etc/completion/bash/guix (_guix_complete): Handle "install", "remove",
and "upgrade".
2019-04-29 10:13:44 +02:00
Ludovic Courtès 7082873ea2
bash completion: Restore completion of available packages for 'guix build'.
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.
2018-11-06 00:04:11 +01:00
Oleg Pykhalov 3a15d0aa9c
bash completion: Complete files names after 'guix weather -m'.
* etc/completion/bash/guix (_guix_complete): Complete files names after 'guix
weather -m'.
2018-07-03 06:58:51 +03:00
Oleg Pykhalov 9b0a755f64
bash completion: Complete files names after 'guix build -L'.
* etc/completion/bash/guix (_guix_complete): Complete files names after 'guix
build -L'.
2018-07-03 06:58:51 +03:00
Oleg Pykhalov bba0fa2499
Add guix-daemon Bash completion file.
* etc/completion/bash/guix-daemon: New file.
* Makefile.am (dist_bashcompletion_DATA): Add this.
2018-06-16 21:23:11 +03:00
Oleg Pykhalov f5f916792c
bash completion: Complete files names after 'guix package -m'.
* etc/completion/bash/guix (_guix_is_dash_m): New function.
(_guix_complete): Add this.
2018-02-17 22:23:07 +03:00
Marius Bakke ed8634c404
bash completion: Complete files names after 'guix download'.
* etc/completion/bash/guix (_guix_complete): When the command is "download",
use __guix_complete_file.
2017-08-22 23:13:42 +02:00
Ludovic Courtès f2c66fbe1f
bash completion: Complete subcommands for the current word.
* etc/completion/bash/guix (_guix_complete_subcommand): Refer to
the $COMP_CWORD element instead of the last element.
2017-02-07 00:08:10 +01:00
Ludovic Courtès a93c1c5921
bash completion: Properly complete 'guix container exec'.
* etc/completion/bash/guix (_guix_complete_pid): New function.
(_guix_complete): Add case for "container".
2017-02-07 00:08:10 +01:00
Ludovic Courtès e109ed3922
bash completion: Complete file names after 'guix system COMMAND'.
* etc/completion/bash/guix (_guix_complete): When the command is
"system" and $COMP_CWORD > 2, use _guix_complete_file.
2017-02-07 00:08:10 +01:00
Ludovic Courtès 3454f7edf9
bash completion: Complete 'guix gc' with file names.
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'.
2017-02-07 00:08:10 +01:00
Ludovic Courtès f07f7d8614
bash completion: Complete subcommands and their options.
* 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".
2016-09-07 17:33:48 +02:00
Ludovic Courtès e9006d06a0
bash completion: Redirect 'guix' stderr to /dev/null.
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'.
2016-09-07 16:22:25 +02:00
Ludovic Courtès 4a9999871c bash completion: Cache the list of subcommands and available packages.
* 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.
2015-08-20 19:57:33 +02:00
Ludovic Courtès 868ef9aec7 bash completion: Complete long options with no short variant.
* etc/completion/bash/guix (_guix_complete_option): Change grep regexp
  to match options that don't have a short option name.
2015-05-01 17:39:39 +02:00
Ludovic Courtès ee3e157dec Add Bash completion file.
* etc/completion/bash/guix: New file.
* Makefile.am (dist_bashcompletion_DATA): New variable.
* configure.ac: Add --with-bash-completion-dir.
2015-04-09 23:44:14 +02:00