aboutsummaryrefslogtreecommitdiff
path: root/etc/completion/bash
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-12-04 18:19:22 +0100
committerLudovic Courtès <ludo@gnu.org>2020-12-04 23:45:08 +0100
commit611ae310f4ca1d93600c280e940a69b07e20c350 (patch)
treea3055acc3b3ed51053b2ac5ba68b2923c0cf0f1f /etc/completion/bash
parentc2352335ca3ccbfee5b1581a832e38bc9a15c4f9 (diff)
downloadguix-611ae310f4ca1d93600c280e940a69b07e20c350.tar
guix-611ae310f4ca1d93600c280e940a69b07e20c350.tar.gz
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'.
Diffstat (limited to 'etc/completion/bash')
-rw-r--r--etc/completion/bash/guix24
1 files changed, 21 insertions, 3 deletions
diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
index fdbdf46810..26480e5863 100644
--- a/etc/completion/bash/guix
+++ b/etc/completion/bash/guix
@@ -111,6 +111,24 @@ _guix_is_removing ()
$result
}
+_guix_is_dash_f ()
+{
+ [ "${COMP_WORDS[$COMP_CWORD - 1]}" = "-f" ] \
+ || { case "${COMP_WORDS[$COMP_CWORD]}" in
+ --file=*|--install-from-file=*) true;;
+ *) false;;
+ esac }
+}
+
+_guix_is_dash_l ()
+{
+ [ "${COMP_WORDS[$COMP_CWORD - 1]}" = "-l" ] \
+ || { case "${COMP_WORDS[$COMP_CWORD]}" in
+ --load=*) true;;
+ *) false;;
+ esac }
+}
+
_guix_is_dash_L ()
{
[ "${COMP_WORDS[$COMP_CWORD - 1]}" = "-L" ] \
@@ -182,7 +200,7 @@ _guix_complete ()
*)
if _guix_is_command "package"
then
- if _guix_is_dash_L || _guix_is_dash_m || _guix_is_dash_p
+ if _guix_is_dash_L || _guix_is_dash_m || _guix_is_dash_p || _guix_is_dash_f
then
_guix_complete_file
elif _guix_is_removing
@@ -217,7 +235,7 @@ _guix_complete ()
fi
elif _guix_is_command "build"
then
- if _guix_is_dash_L || _guix_is_dash_m
+ if _guix_is_dash_L || _guix_is_dash_m || _guix_is_dash_f
then
_guix_complete_file
else
@@ -225,7 +243,7 @@ _guix_complete ()
fi
elif _guix_is_command "environment"
then
- if _guix_is_dash_L || _guix_is_dash_m || _guix_is_dash_p
+ if _guix_is_dash_L || _guix_is_dash_m || _guix_is_dash_p || _guix_is_dash_l
then
_guix_complete_file
else