diff --git a/completions/e2fsprogs b/completions/e2fsprogs index 23962dad..32520c04 100644 --- a/completions/e2fsprogs +++ b/completions/e2fsprogs @@ -17,9 +17,11 @@ _badblocks() esac if [[ "$cur" == -* ]]; then - # -w (dangerous) and -X (internal use) not here on purpose - COMPREPLY=( $( compgen -W '-b -c -e -d -f -i -n -o -p -s -t -v' \ - -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + # Filter out -w (dangerous) and -X (internal use) + for i in ${!COMPREPLY[@]}; do + [[ ${COMPREPLY[i]} == -[wX] ]] && unset COMPREPLY[i] + done return 0 fi @@ -46,7 +48,7 @@ _dumpe2fs() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-b -o -f -h -i -x -V' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) return 0 fi @@ -69,7 +71,7 @@ _e2freefrag() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-c -h' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" -h )' -- "$cur" ) ) return 0 fi @@ -100,7 +102,7 @@ _filefrag() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-B -b -s -v -x' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) return 0 fi @@ -156,8 +158,8 @@ _tune2fs() esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-c -C -e -E -f -g -i -j -J -l -L -m -M -o - -O -r -T -u -U' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) + return fi cur=${cur:=/dev/} diff --git a/completions/shadow b/completions/shadow index de78c592..b3c00d89 100644 --- a/completions/shadow +++ b/completions/shadow @@ -131,14 +131,13 @@ _passwd() _init_completion || return case $prev in - -n|-x|-w|-i|-\?|--help|--usage) + -n|--minimum|-x|--maximum|-w|--warning|-i|--inactive|-\?|--help|--usage) return 0 ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-k -l --stdin -u -d -n -x -w -i -S \ - -? --help --usage' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) return 0 fi @@ -209,7 +208,7 @@ _pwck() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-q -r -s' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) return 0 fi @@ -339,7 +338,7 @@ _grpck() _init_completion || return if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-r -s' -- "$cur" ) ) + COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) ) return 0 fi