From 80edb7df6586464aa40e84e103f0045452de95db Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 1 Oct 2021 15:19:54 +0200 Subject: Add 'guix shell'. * guix/scripts/shell.scm, tests/guix-shell.sh: New files. * Makefile.am (MODULES): Add 'shell.scm'. (SH_TESTS): Add 'tests/guix-shell.sh'. * guix/scripts/environment.scm (show-environment-options-help): New procedure. (show-help): Use it. (guix-environment*): New procedure. (guix-environment): Use it. * po/guix/POTFILES.in: Add it. * doc/guix.texi (Features): Refer to "guix shell" (Invoking guix package): Likewise. (Development): Likewise. (Invoking guix shell): New node. (Invoking guix environment): Add deprecation warning. (Debugging Build Failures): Use 'guix shell' in examples. (Invoking guix container): Refer to 'guix shell'. (Invoking guix processes, Virtualization Services): Adjust examples to use 'guix shell'. * doc/contributing.texi (Building from Git): Refer to 'guix shell'. * etc/completion/bash/guix: Handle "shell". --- etc/completion/bash/guix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'etc/completion/bash') diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix index 87d9911e53..ec6adfdb22 100644 --- a/etc/completion/bash/guix +++ b/etc/completion/bash/guix @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès +# Copyright © 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès # Copyright © 2021 Tobias Geerinck-Rice # # This file is part of GNU Guix. @@ -215,7 +215,7 @@ _guix_complete () if [[ "$word" = "--" ]] then case "$command" in - environment) + environment|shell) break ;; time-machine) @@ -265,7 +265,7 @@ _guix_complete () else _guix_complete_available_package_or_store_file "$word_at_point" fi - elif [[ "$command" = "environment" ]] + elif [[ "$command" = "environment" || "$command" = "shell" ]] then if _guix_is_dash_L || _guix_is_dash_m || _guix_is_dash_p || _guix_is_dash_l then -- cgit v1.2.3 From 0987a0eba4e8220e98e93686a4ad3ef87433fb2f Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sat, 30 Oct 2021 16:34:10 +0200 Subject: bash completion: Don't hard-code "guix" binary name. * etc/completion/bash/guix (_guix_complete_command): Use ${COMP_WORDS[0]} instead of hard-coding "guix". --- etc/completion/bash/guix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'etc/completion/bash') diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix index ec6adfdb22..5d1ae37f12 100644 --- a/etc/completion/bash/guix +++ b/etc/completion/bash/guix @@ -28,10 +28,11 @@ _guix_complete_command () if [ -z "$_guix_commands" ] then # Cache the list of commands to speed things up. - _guix_commands="$(guix --help 2> /dev/null \ + _guix_commands="$(${COMP_WORDS[0]} --help 2> /dev/null \ | grep '^ ' \ | sed '-es/^ *\([a-z-]\+\).*$/\1/g')" fi + COMPREPLY+=($(compgen -W "$_guix_commands" -- "$word_at_point")) } -- cgit v1.2.3 From 8e6989fcaf4a6de00e799777e2a0ccb90fc05e59 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sat, 30 Oct 2021 16:37:25 +0200 Subject: bash completion: Complete top-level options. * etc/completion/bash/guix (_guix_complete_option): Fix operation without a {,sub}command. (_guix_complete): Call it also when no command is given. --- etc/completion/bash/guix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'etc/completion/bash') diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix index 5d1ae37f12..6a11e1b23b 100644 --- a/etc/completion/bash/guix +++ b/etc/completion/bash/guix @@ -72,10 +72,16 @@ _guix_complete_option () { local command="${COMP_WORDS[$1]}" local subcommand="${COMP_WORDS[$(($1 + 1))]}" - if _guix_is_option "$subcommand" + + if [ $1 -le 1 ] + then + command="" + subcommand="" + elif _guix_is_option "$subcommand" then subcommand="" fi + local options="$(${COMP_WORDS[0]} $command $subcommand --help 2> /dev/null \ | grep '^ \+-' \ | sed -e's/^.*--\([a-zA-Z0-9_-]\+\)\(=\?\).*/--\1\2/g')" @@ -229,6 +235,7 @@ _guix_complete () case $COMP_CWORD in $command_index) _guix_complete_command + _guix_complete_option 0 "$word_at_point" ;; *) if [[ "$command" = "package" ]] -- cgit v1.2.3