[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 90387f2355ae83968ab12aa32ba3b73fac152fd4
Ville Skyttä
ville.skytta at iki.fi
Tue May 26 18:26:54 UTC 2009
The following commit has been merged in the master branch:
commit 90387f2355ae83968ab12aa32ba3b73fac152fd4
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Tue May 26 21:26:47 2009 +0300
Use _split_longopt in quota and friends.
diff --git a/CHANGES b/CHANGES
index 6009413..d685f93 100644
--- a/CHANGES
+++ b/CHANGES
@@ -39,7 +39,8 @@ bash-completion (1.x)
take arguments in both "--foo bar" and "--foo=bar" formats.
* Use _split_longopt to improve and clean up aspell, chgrp, chown, chkconfig,
cpio, iptables, make, mc, mii-diag, mii-tool, mkinitrd, postgresql,
- samba, smartctl, and generic long option completion (Alioth: #311398).
+ quota, samba, smartctl, and generic long option completion
+ (Alioth: #311398).
* Add chown --from and --reference value completions.
* Add chgrp --reference value completion.
* Do not assume all --foo= options take filenames in generic long option
diff --git a/contrib/quota-tools b/contrib/quota-tools
index f61d6cd..d3eb273 100644
--- a/contrib/quota-tools
+++ b/contrib/quota-tools
@@ -35,32 +35,25 @@ _filesystems()
_quota()
{
- local cur prev
+ local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
+ _split_longopt && split=true
+
case $prev in
- -F)
+ -F|--format)
_quota_formats
return 0
;;
esac
-
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case $prev in
- --format)
- _quota_formats
- return 0
- ;;
- esac
- fi
+
+ $split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-F --format= -g --group -u --user -v --verbose \
+ COMPREPLY=( $( compgen -W '-F --format -g --group -u --user -v --verbose \
-s --human-readable -p --raw-grace -i --no-autofs -l --local-only \
-A --all-nfs -m --no-mixed-pathnames -q --quiet -Q --quiet-refuse \
-w --no-wrap' -- $cur ) )
@@ -72,33 +65,26 @@ complete -F _quota $default quota
_setquota()
{
- local cur prev
+ local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
+ _split_longopt && split=true
+
case $prev in
- -F)
+ -F|--format)
_quota_formats
return 0
;;
esac
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case $prev in
- --format)
- _quota_formats
- return 0
- ;;
- esac
- fi
+ $split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \
- -F --format= -g --group -u --user -p --prototype= -b --batch \
+ -F --format -g --group -u --user -p --prototype -b --batch \
-c --continue-batch -t --edit-period -T --edit-times -a --all' -- $cur ) )
else
_count_args
@@ -118,14 +104,16 @@ complete -F _setquota $default setquota
_edquota()
{
- local cur prev
+ local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
+ _split_longopt && split=true
+
case $prev in
- -F)
+ -F|--format)
_quota_formats
return 0
;;
@@ -135,20 +123,11 @@ _edquota()
;;
esac
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case $prev in
- --format)
- _quota_formats
- return 0
- ;;
- esac
- fi
+ $split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \
- -g --group -u --user -p --prototype= -F --format= -f --filesystem \
+ -g --group -u --user -p --prototype -F --format -f --filesystem \
-t --edit-period -T --edit-times' -- $cur ) )
else
_user_or_group
@@ -158,35 +137,28 @@ complete -F _edquota $default edquota
_quotacheck()
{
- local cur prev
+ local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
+ _split_longopt && split=true
+
case $prev in
- -F)
+ -F|--format)
_quota_formats
return 0
;;
esac
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case $prev in
- --format)
- _quota_formats
- return 0
- ;;
- esac
- fi
+ $split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-b --backup -v --verbose -d --debug \
-g --group -u --user -c --create-files -f --force -i \
--interactive -n --use-first-dquot -M --try-remount -m \
- --no-remount -R --exclude-root -F --format= -a --all' \
+ --no-remount -R --exclude-root -F --format -a --all' \
-- $cur ) )
else
_filesystems
@@ -196,35 +168,28 @@ complete -F _quotacheck $default quotacheck
_repquota()
{
- local cur prev
+ local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
+ _split_longopt && split=true
+
case $prev in
- -F)
+ -F|--format)
_quota_formats
return 0
;;
esac
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case $prev in
- --format)
- _quota_formats
- return 0
- ;;
- esac
- fi
+ $split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a --all -v --verbose -s --human-readable \
-c --batch-translation -C --no-batch-translation -t \
--truncate-names -n --no-names -p --raw-grace -i --no-autofs \
- -u --user -g --group -F --format=' -- $cur ) )
+ -u --user -g --group -F --format' -- $cur ) )
else
_filesystems
fi
@@ -233,33 +198,26 @@ complete -F _repquota $default repquota
_quotaon()
{
- local cur prev
+ local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
+ _split_longopt && split=true
+
case $prev in
- -F)
+ -F|--format)
_quota_formats
return 0
;;
esac
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case $prev in
- --format)
- _quota_formats
- return 0
- ;;
- esac
- fi
+ $split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \
- -g --group -f --off -p --print-state -F --format=' -- $cur ) )
+ -g --group -f --off -p --print-state -F --format' -- $cur ) )
else
_filesystems
fi
@@ -268,14 +226,16 @@ complete -F _quotaon $default quotaon
_quotaoff()
{
- local cur prev
+ local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
+ _split_longopt && split=true
+
case $prev in
- -F)
+ -F|--format)
_quota_formats
return 0
;;
@@ -285,20 +245,11 @@ _quotaoff()
;;
esac
- if [[ "$cur" == *=* ]]; then
- prev=${cur/=*/}
- cur=${cur/*=/}
- case $prev in
- --format)
- _quota_formats
- return 0
- ;;
- esac
- fi
+ $split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \
- -g --group -p --print-state -x --xfs-command -F --format=' \
+ -g --group -p --print-state -x --xfs-command -F --format' \
-- $cur ) )
else
_filesystems
--
bash-completion
More information about the Bash-completion-commits
mailing list