diff options
| -rw-r--r-- | etc/completion/bash/guix | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix index 6b1b70aac1d..7b1f639371f 100644 --- a/etc/completion/bash/guix +++ b/etc/completion/bash/guix | |||
| @@ -117,58 +117,59 @@ _guix_is_removing () | |||
| 117 | $result | 117 | $result |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | _guix_is_short_option () | ||
| 121 | { | ||
| 122 | case "${COMP_WORDS[$COMP_CWORD - 1]}" in | ||
| 123 | --*) false;; | ||
| 124 | -*$1) true ;; | ||
| 125 | *) false ;; | ||
| 126 | esac | ||
| 127 | } | ||
| 128 | |||
| 129 | _guix_is_long_option () | ||
| 130 | { | ||
| 131 | # Don't handle (non-GNU?) ‘--long-option VALUE’, as Guix doesn't either. | ||
| 132 | case "${COMP_WORDS[$COMP_CWORD]}" in | ||
| 133 | --$1=*) true ;; | ||
| 134 | *) false ;; | ||
| 135 | esac | ||
| 136 | } | ||
| 137 | |||
| 120 | _guix_is_dash_f () | 138 | _guix_is_dash_f () |
| 121 | { | 139 | { |
| 122 | [ "${COMP_WORDS[$COMP_CWORD - 1]}" = "-f" ] \ | 140 | _guix_is_short_option f || |
| 123 | || { case "${COMP_WORDS[$COMP_CWORD]}" in | 141 | _guix_is_long_option file || |
| 124 | --file=*|--install-from-file=*) true;; | 142 | _guix_is_long_option install-from-file |
| 125 | *) false;; | ||
| 126 | esac } | ||
| 127 | } | 143 | } |
| 128 | 144 | ||
| 129 | _guix_is_dash_l () | 145 | _guix_is_dash_l () |
| 130 | { | 146 | { |
| 131 | [ "${COMP_WORDS[$COMP_CWORD - 1]}" = "-l" ] \ | 147 | _guix_is_short_option l || |
| 132 | || { case "${COMP_WORDS[$COMP_CWORD]}" in | 148 | _guix_is_long_option load |
| 133 | --load=*) true;; | ||
| 134 | *) false;; | ||
| 135 | esac } | ||
| 136 | } | 149 | } |
| 137 | 150 | ||
| 138 | _guix_is_dash_L () | 151 | _guix_is_dash_L () |
| 139 | { | 152 | { |
| 140 | [ "${COMP_WORDS[$COMP_CWORD - 1]}" = "-L" ] \ | 153 | _guix_is_short_option L || |
| 141 | || { case "${COMP_WORDS[$COMP_CWORD]}" in | 154 | _guix_is_long_option load-path |
| 142 | --load-path=*) true;; | ||
| 143 | *) false;; | ||
| 144 | esac } | ||
| 145 | } | 155 | } |
| 146 | 156 | ||
| 147 | _guix_is_dash_m () | 157 | _guix_is_dash_m () |
| 148 | { | 158 | { |
| 149 | [ "${COMP_WORDS[$COMP_CWORD - 1]}" = "-m" ] \ | 159 | _guix_is_short_option m || |
| 150 | || { case "${COMP_WORDS[$COMP_CWORD]}" in | 160 | _guix_is_long_option manifest |
| 151 | --manifest=*) true;; | ||
| 152 | *) false;; | ||
| 153 | esac } | ||
| 154 | } | 161 | } |
| 155 | 162 | ||
| 156 | _guix_is_dash_C () | 163 | _guix_is_dash_C () |
| 157 | { | 164 | { |
| 158 | [ "${COMP_WORDS[$COMP_CWORD - 1]}" = "-C" ] \ | 165 | _guix_is_short_option C || |
| 159 | || { case "${COMP_WORDS[$COMP_CWORD]}" in | 166 | _guix_is_long_option channels |
| 160 | --channels=*) true;; | ||
| 161 | *) false;; | ||
| 162 | esac } | ||
| 163 | } | 167 | } |
| 164 | 168 | ||
| 165 | _guix_is_dash_p () | 169 | _guix_is_dash_p () |
| 166 | { | 170 | { |
| 167 | [ "${COMP_WORDS[$COMP_CWORD - 1]}" = "-p" ] \ | 171 | _guix_is_short_option p || |
| 168 | || { case "${COMP_WORDS[$COMP_CWORD]}" in | 172 | _guix_is_long_option profile |
| 169 | --profile=*) true;; | ||
| 170 | *) false;; | ||
| 171 | esac } | ||
| 172 | } | 173 | } |
| 173 | 174 | ||
| 174 | _guix_complete_file () | 175 | _guix_complete_file () |
