bash-completion: fsck.cramfs, isosize: find files an argument

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>
This commit is contained in:
Sami Kerola 2016-03-13 10:31:45 +00:00 committed by Karel Zak
parent aeb9298d3e
commit 5f57e1420c
2 changed files with 18 additions and 4 deletions

View 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

View 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