2009-02-05 10:53:04 +01:00
|
|
|
# bash completion for quota-tools
|
|
|
|
|
|
|
|
have quota && {
|
|
|
|
_user_or_group()
|
|
|
|
{
|
|
|
|
local i
|
|
|
|
|
|
|
|
# complete on groups if -g was given
|
|
|
|
for (( i=1; i < COMP_CWORD; i++ )); do
|
|
|
|
if [[ "${COMP_WORDS[i]}" == -g ]]; then
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
COMPREPLY=( $( compgen -g -- "$cur" ) )
|
2009-02-05 10:53:04 +01:00
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# otherwise complete on users
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
COMPREPLY=( $( compgen -u -- "$cur" ) )
|
2009-02-05 10:53:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
_quota_formats()
|
|
|
|
{
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
COMPREPLY=( $( compgen -W 'vfsold vfsv0 rpc xfs' -- "$cur" ) )
|
2009-02-05 10:53:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
_filesystems()
|
|
|
|
{
|
|
|
|
# Only list filesystems starting with "/", otherwise we also get
|
|
|
|
#+ "binfmt_misc", "proc", "tmpfs", ...
|
|
|
|
COMPREPLY=( $( compgen -W "$(awk '/^\// {print $1}' /etc/mtab)" \
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
-- "$cur" ) )
|
2009-02-05 10:53:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
_quota()
|
|
|
|
{
|
2009-05-26 21:26:47 +03:00
|
|
|
local cur prev split=false
|
2009-02-05 10:53:04 +01:00
|
|
|
|
|
|
|
COMPREPLY=()
|
|
|
|
cur=`_get_cword`
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
|
|
|
2009-05-26 21:26:47 +03:00
|
|
|
_split_longopt && split=true
|
|
|
|
|
2009-02-05 10:53:04 +01:00
|
|
|
case $prev in
|
2009-05-26 21:26:47 +03:00
|
|
|
-F|--format)
|
2009-02-05 10:53:04 +01:00
|
|
|
_quota_formats
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
2009-05-26 21:26:47 +03:00
|
|
|
|
|
|
|
$split && return 0
|
2009-02-05 10:53:04 +01:00
|
|
|
|
|
|
|
if [[ "$cur" == -* ]]; then
|
2009-05-26 21:26:47 +03:00
|
|
|
COMPREPLY=( $( compgen -W '-F --format -g --group -u --user -v --verbose \
|
2009-02-05 10:53:04 +01:00
|
|
|
-s --human-readable -p --raw-grace -i --no-autofs -l --local-only \
|
|
|
|
-A --all-nfs -m --no-mixed-pathnames -q --quiet -Q --quiet-refuse \
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
-w --no-wrap' -- "$cur" ) )
|
2009-02-05 10:53:04 +01:00
|
|
|
else
|
|
|
|
_user_or_group
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
complete -F _quota $default quota
|
|
|
|
|
|
|
|
_setquota()
|
|
|
|
{
|
2009-05-26 21:26:47 +03:00
|
|
|
local cur prev split=false
|
2009-02-05 10:53:04 +01:00
|
|
|
|
|
|
|
COMPREPLY=()
|
|
|
|
cur=`_get_cword`
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
|
|
|
2009-05-26 21:26:47 +03:00
|
|
|
_split_longopt && split=true
|
|
|
|
|
2009-02-05 10:53:04 +01:00
|
|
|
case $prev in
|
2009-05-26 21:26:47 +03:00
|
|
|
-F|--format)
|
2009-02-05 10:53:04 +01:00
|
|
|
_quota_formats
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2009-05-26 21:26:47 +03:00
|
|
|
$split && return 0
|
2009-02-05 10:53:04 +01:00
|
|
|
|
|
|
|
if [[ "$cur" == -* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \
|
2009-05-26 21:26:47 +03:00
|
|
|
-F --format -g --group -u --user -p --prototype -b --batch \
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
-c --continue-batch -t --edit-period -T --edit-times -a --all' -- "$cur" ) )
|
2009-02-05 10:53:04 +01:00
|
|
|
else
|
|
|
|
_count_args
|
|
|
|
|
|
|
|
case $args in
|
|
|
|
1)
|
|
|
|
_user_or_group
|
|
|
|
;;
|
|
|
|
2)
|
|
|
|
_filesystems
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
complete -F _setquota $default setquota
|
|
|
|
|
|
|
|
_edquota()
|
|
|
|
{
|
2009-05-26 21:26:47 +03:00
|
|
|
local cur prev split=false
|
2009-02-05 10:53:04 +01:00
|
|
|
|
|
|
|
COMPREPLY=()
|
|
|
|
cur=`_get_cword`
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
|
|
|
2009-05-26 21:26:47 +03:00
|
|
|
_split_longopt && split=true
|
|
|
|
|
2009-02-05 10:53:04 +01:00
|
|
|
case $prev in
|
2009-05-26 21:26:47 +03:00
|
|
|
-F|--format)
|
2009-02-05 10:53:04 +01:00
|
|
|
_quota_formats
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-@(f|-filesystem))
|
|
|
|
_filesystems
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2009-05-26 21:26:47 +03:00
|
|
|
$split && return 0
|
2009-02-05 10:53:04 +01:00
|
|
|
|
|
|
|
if [[ "$cur" == -* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '-r --remote -m --no-mixed-pathnames \
|
2009-05-26 21:26:47 +03:00
|
|
|
-g --group -u --user -p --prototype -F --format -f --filesystem \
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
-t --edit-period -T --edit-times' -- "$cur" ) )
|
2009-02-05 10:53:04 +01:00
|
|
|
else
|
|
|
|
_user_or_group
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
complete -F _edquota $default edquota
|
|
|
|
|
|
|
|
_quotacheck()
|
|
|
|
{
|
2009-05-26 21:26:47 +03:00
|
|
|
local cur prev split=false
|
2009-02-05 10:53:04 +01:00
|
|
|
|
|
|
|
COMPREPLY=()
|
|
|
|
cur=`_get_cword`
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
|
|
|
2009-05-26 21:26:47 +03:00
|
|
|
_split_longopt && split=true
|
|
|
|
|
2009-02-05 10:53:04 +01:00
|
|
|
case $prev in
|
2009-05-26 21:26:47 +03:00
|
|
|
-F|--format)
|
2009-02-05 10:53:04 +01:00
|
|
|
_quota_formats
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2009-05-26 21:26:47 +03:00
|
|
|
$split && return 0
|
2009-02-05 10:53:04 +01:00
|
|
|
|
|
|
|
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 \
|
2009-05-26 21:26:47 +03:00
|
|
|
--no-remount -R --exclude-root -F --format -a --all' \
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
-- "$cur" ) )
|
2009-02-05 10:53:04 +01:00
|
|
|
else
|
|
|
|
_filesystems
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
complete -F _quotacheck $default quotacheck
|
|
|
|
|
|
|
|
_repquota()
|
|
|
|
{
|
2009-05-26 21:26:47 +03:00
|
|
|
local cur prev split=false
|
2009-02-05 10:53:04 +01:00
|
|
|
|
|
|
|
COMPREPLY=()
|
|
|
|
cur=`_get_cword`
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
|
|
|
2009-05-26 21:26:47 +03:00
|
|
|
_split_longopt && split=true
|
|
|
|
|
2009-02-05 10:53:04 +01:00
|
|
|
case $prev in
|
2009-05-26 21:26:47 +03:00
|
|
|
-F|--format)
|
2009-02-05 10:53:04 +01:00
|
|
|
_quota_formats
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2009-05-26 21:26:47 +03:00
|
|
|
$split && return 0
|
2009-02-05 10:53:04 +01:00
|
|
|
|
|
|
|
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 \
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
-u --user -g --group -F --format' -- "$cur" ) )
|
2009-02-05 10:53:04 +01:00
|
|
|
else
|
|
|
|
_filesystems
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
complete -F _repquota $default repquota
|
|
|
|
|
|
|
|
_quotaon()
|
|
|
|
{
|
2009-05-26 21:26:47 +03:00
|
|
|
local cur prev split=false
|
2009-02-05 10:53:04 +01:00
|
|
|
|
|
|
|
COMPREPLY=()
|
|
|
|
cur=`_get_cword`
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
|
|
|
2009-05-26 21:26:47 +03:00
|
|
|
_split_longopt && split=true
|
|
|
|
|
2009-02-05 10:53:04 +01:00
|
|
|
case $prev in
|
2009-05-26 21:26:47 +03:00
|
|
|
-F|--format)
|
2009-02-05 10:53:04 +01:00
|
|
|
_quota_formats
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2009-05-26 21:26:47 +03:00
|
|
|
$split && return 0
|
2009-02-05 10:53:04 +01:00
|
|
|
|
|
|
|
if [[ "$cur" == -* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
-g --group -f --off -p --print-state -F --format' -- "$cur" ) )
|
2009-02-05 10:53:04 +01:00
|
|
|
else
|
|
|
|
_filesystems
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
complete -F _quotaon $default quotaon
|
|
|
|
|
|
|
|
_quotaoff()
|
|
|
|
{
|
2009-05-26 21:26:47 +03:00
|
|
|
local cur prev split=false
|
2009-02-05 10:53:04 +01:00
|
|
|
|
|
|
|
COMPREPLY=()
|
|
|
|
cur=`_get_cword`
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
|
|
|
2009-05-26 21:26:47 +03:00
|
|
|
_split_longopt && split=true
|
|
|
|
|
2009-02-05 10:53:04 +01:00
|
|
|
case $prev in
|
2009-05-26 21:26:47 +03:00
|
|
|
-F|--format)
|
2009-02-05 10:53:04 +01:00
|
|
|
_quota_formats
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-@(x|-xfs-command))
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
COMPREPLY=( $( compgen -W 'delete enforce' -- "$cur" ) )
|
2009-02-05 10:53:04 +01:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2009-05-26 21:26:47 +03:00
|
|
|
$split && return 0
|
2009-02-05 10:53:04 +01:00
|
|
|
|
|
|
|
if [[ "$cur" == -* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '-a --all -v --verbose -u --user \
|
2009-05-26 21:26:47 +03:00
|
|
|
-g --group -p --print-state -x --xfs-command -F --format' \
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
-- "$cur" ) )
|
2009-02-05 10:53:04 +01:00
|
|
|
else
|
|
|
|
_filesystems
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
complete -F _quotaoff $default quotaoff
|
|
|
|
}
|
2009-10-01 20:54:51 +03:00
|
|
|
|
|
|
|
# Local variables:
|
|
|
|
# mode: shell-script
|
|
|
|
# sh-basic-offset: 8
|
|
|
|
# sh-indent-comment: t
|
|
|
|
# indent-tabs-mode: t
|
|
|
|
# End:
|
|
|
|
# ex: ts=8 sw=8 noet filetype=sh
|