]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
bash-completion: fsck.cramfs, isosize: find files an argument
authorSami Kerola <kerolasa@iki.fi>
Sun, 13 Mar 2016 10:31:45 +0000 (10:31 +0000)
committerKarel Zak <kzak@redhat.com>
Mon, 14 Mar 2016 12:15:13 +0000 (13:15 +0100)
Earlier completion suggested only options for the command, this changes
options to be proposed when first character of an argument is dash.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
bash-completion/fsck.cramfs
bash-completion/isosize

index acf656411d61d07a52f208de167b20dcdac7a00f..b3276b97452f0c18005ae7f9d57377e13af43a15 100644 (file)
@@ -15,8 +15,15 @@ _fsck.cramfs_module()
                        return 0
                        ;;
        esac
-       OPTS='--verbose --destination --help --version file'
-       COMPREPLY=( $(compgen -W "${OPTS[*]}" -S ' ' -- $cur) )
+       case $cur in
+               -*)
+                       COMPREPLY=( $(compgen -W "--verbose --blocksize --extract --help --version" -- $cur) )
+                       return 0
+                       ;;
+       esac
+       local IFS=$'\n'
+       compopt -o filenames
+       COMPREPLY=( $(compgen -f -- $cur) )
        return 0
 }
 complete -F _fsck.cramfs_module fsck.cramfs
index 13d4d298a7e3fa6cfec604afef9f9a2aebf9007c..fec2f8b8f461bc0ef83b602edad54abf0e343173 100644 (file)
@@ -13,8 +13,15 @@ _isosize_module()
                        return 0
                        ;;
        esac
-       OPTS='--divisor --sectors --help --version'
-       COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+       case $cur in
+               -*)
+                       COMPREPLY=( $(compgen -W "--divisor --sectors --help --version" -- $cur) )
+                       return 0
+                       ;;
+       esac
+       local IFS=$'\n'
+       compopt -o filenames
+       COMPREPLY=( $(compgen -f -- $cur) )
        return 0
 }
 complete -F _isosize_module isosize