]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bash-completion: bootctl: suggest argument for --path option
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 13 Dec 2018 16:26:25 +0000 (01:26 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 13 Dec 2018 16:26:25 +0000 (01:26 +0900)
shell-completion/bash/bootctl

index f45e3e2a97353dc4b26f8b288b094bec69f08084..648103fbc0ae6a0dfdf482b8b07f0ebb39a67a6e 100644 (file)
@@ -32,6 +32,21 @@ _bootctl() {
                        [ARG]='--path'
         )
 
+        if __contains_word "$prev" ${OPTS[ARG]}; then
+                case $prev in
+                        --path)
+                                if [[ -z $cur ]]; then
+                                        comps=$(compgen -A directory -- "/" )
+                                else
+                                        comps=$(compgen -A directory -- "$cur" )
+                                fi
+                                compopt -o filenames
+                                ;;
+                esac
+                COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
+                return 0
+        fi
+
         if [[ "$cur" = -* ]]; then
                 COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
                 return 0