[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-241-g0a40e98
Ville Skyttä
ville.skytta at iki.fi
Mon May 2 12:23:14 UTC 2011
The following commit has been merged in the master branch:
commit e1cc0e178b538a0b2ddb6e1caa16f7786559a37b
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Mon May 2 14:07:30 2011 +0300
e2fsprogs, passwd, pwck, grpck: Use _parse_usage instead of hardcoded option lists.
diff --git a/completions/e2fsprogs b/completions/e2fsprogs
index 23962da..32520c0 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 de78c59..b3c00d8 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
--
bash-completion
More information about the Bash-completion-commits
mailing list