2009-06-05 08:41:27 +02:00
|
|
|
# cvs(1) completion
|
2009-10-01 20:54:51 +03:00
|
|
|
|
2009-06-05 08:41:27 +02:00
|
|
|
have cvs && {
|
|
|
|
set_prefix()
|
|
|
|
{
|
|
|
|
[ -z ${prefix:-} ] || prefix=${cur%/*}/
|
|
|
|
[ -r ${prefix:-}CVS/Entries ] || prefix=""
|
|
|
|
}
|
|
|
|
|
|
|
|
get_entries()
|
|
|
|
{
|
|
|
|
local IFS=$'\n'
|
|
|
|
[ -r ${prefix:-}CVS/Entries ] && \
|
|
|
|
entries=$(cut -d/ -f2 -s ${prefix:-}CVS/Entries)
|
|
|
|
}
|
|
|
|
|
|
|
|
get_modules()
|
|
|
|
{
|
|
|
|
if [ -n "$prefix" ]; then
|
|
|
|
COMPREPLY=( $( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ) )
|
|
|
|
else
|
|
|
|
COMPREPLY=( $( command ls -d ${cvsroot}/!(CVSROOT) ) )
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_cvs()
|
|
|
|
{
|
|
|
|
local cur count mode i cvsroot cvsroots pwd
|
|
|
|
local -a flags miss files entries changed newremoved
|
|
|
|
|
|
|
|
COMPREPLY=()
|
|
|
|
cur=`_get_cword`
|
|
|
|
|
|
|
|
count=0
|
|
|
|
for i in "${COMP_WORDS[@]}"; do
|
|
|
|
[ $count -eq $COMP_CWORD ] && break
|
|
|
|
# Last parameter was the CVSROOT, now go back to mode selection
|
|
|
|
if [ "${COMP_WORDS[((count))]}" == "$cvsroot" -a "$mode" == "cvsroot" ]; then
|
|
|
|
mode=""
|
|
|
|
fi
|
|
|
|
if [ -z "$mode" ]; then
|
|
|
|
case $i in
|
|
|
|
-d)
|
|
|
|
mode=cvsroot
|
|
|
|
cvsroot=${COMP_WORDS[((count+1))]}
|
|
|
|
;;
|
|
|
|
@(ad?(d)|new))
|
|
|
|
mode=add
|
|
|
|
;;
|
|
|
|
@(adm?(in)|rcs))
|
|
|
|
mode=admin
|
|
|
|
;;
|
|
|
|
ann?(notate))
|
|
|
|
mode=annotate
|
|
|
|
;;
|
|
|
|
@(checkout|co|get))
|
|
|
|
mode=checkout
|
|
|
|
;;
|
|
|
|
@(com?(mit)|ci))
|
|
|
|
mode=commit
|
|
|
|
;;
|
|
|
|
di?(f?(f)))
|
|
|
|
mode=diff
|
|
|
|
;;
|
|
|
|
ex?(p?(ort)))
|
|
|
|
mode=export
|
|
|
|
;;
|
|
|
|
?(un)edit)
|
|
|
|
mode=$i
|
|
|
|
;;
|
|
|
|
hi?(s?(tory)))
|
|
|
|
mode=history
|
|
|
|
;;
|
|
|
|
im?(p?(ort)))
|
|
|
|
mode=import
|
|
|
|
;;
|
|
|
|
re?(l?(ease)))
|
|
|
|
mode=release
|
|
|
|
;;
|
|
|
|
?(r)log)
|
|
|
|
mode=log
|
|
|
|
;;
|
|
|
|
@(rdiff|patch))
|
|
|
|
mode=rdiff
|
|
|
|
;;
|
|
|
|
@(remove|rm|delete))
|
|
|
|
mode=remove
|
|
|
|
;;
|
|
|
|
@(rtag|rfreeze))
|
|
|
|
mode=rtag
|
|
|
|
;;
|
|
|
|
st?(at?(us)))
|
|
|
|
mode=status
|
|
|
|
;;
|
|
|
|
@(tag|freeze))
|
|
|
|
mode=tag
|
|
|
|
;;
|
|
|
|
up?(d?(ate)))
|
|
|
|
mode=update
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
elif [[ "$i" = -* ]]; then
|
|
|
|
flags=( "${flags[@]}" $i )
|
|
|
|
fi
|
|
|
|
count=$((++count))
|
|
|
|
done
|
|
|
|
|
|
|
|
case "$mode" in
|
|
|
|
add)
|
|
|
|
if [[ "$cur" != -* ]]; then
|
|
|
|
set_prefix
|
|
|
|
if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
|
|
|
|
get_entries
|
|
|
|
[ -z "$cur" ] && \
|
|
|
|
files=$( command ls -Ad !(CVS) ) || \
|
|
|
|
files=$( command ls -d ${cur}* 2>/dev/null )
|
|
|
|
for i in "${entries[@]}"; do
|
|
|
|
files=( ${files[@]/#$i//} )
|
|
|
|
done
|
|
|
|
COMPREPLY=( $( compgen -X '*~' -W '${files[@]}' -- \
|
|
|
|
$cur ) )
|
|
|
|
fi
|
|
|
|
else
|
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 '-k -m' -- "$cur" ) )
|
2009-06-05 08:41:27 +02:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
admin)
|
|
|
|
if [[ "$cur" = -* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '-i -a -A -e -b -c -k -l -u \
|
|
|
|
-L -U -m -M -n -N -o -q -I \
|
|
|
|
-s -t -t- -T -V -x -z' -- \
|
|
|
|
$cur ) )
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
annotate)
|
|
|
|
if [[ "$cur" = -* ]]; 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 -W '-D -F -f -l -R -r' -- "$cur" ) )
|
2009-06-05 08:41:27 +02:00
|
|
|
else
|
|
|
|
get_entries
|
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 '${entries[@]}' -- "$cur" ) )
|
2009-06-05 08:41:27 +02:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
checkout)
|
|
|
|
if [[ "$cur" != -* ]]; then
|
|
|
|
[ -z "$cvsroot" ] && cvsroot=$CVSROOT
|
|
|
|
COMPREPLY=( $( cvs -d "$cvsroot" co -c 2> /dev/null | \
|
|
|
|
awk '{print $1}' ) )
|
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 '${COMPREPLY[@]}' -- "$cur" ) )
|
2009-06-05 08:41:27 +02:00
|
|
|
else
|
|
|
|
COMPREPLY=( $( compgen -W '-A -N -P -R -c -f -l -n -p \
|
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
|
|
|
-s -r -D -d -k -j' -- "$cur" ) )
|
2009-06-05 08:41:27 +02:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
commit)
|
|
|
|
set_prefix
|
|
|
|
|
|
|
|
if [[ "$cur" != -* ]] && [ -r ${prefix:-}CVS/Entries ]; then
|
|
|
|
# if $COMP_CVS_REMOTE is not null, 'cvs commit' will
|
|
|
|
# complete on remotely checked-out files (requires
|
|
|
|
# passwordless access to the remote repository
|
|
|
|
if [ -n "${COMP_CVS_REMOTE:-}" ]; then
|
|
|
|
# this is the least computationally intensive
|
|
|
|
# way found so far, but other changes
|
|
|
|
# (something other than changed/removed/new)
|
|
|
|
# may be missing
|
|
|
|
changed=( $( cvs -q diff --brief 2>&1 | \
|
|
|
|
sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) )
|
|
|
|
newremoved=( $( cvs -q diff --brief 2>&1 | \
|
|
|
|
sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) )
|
|
|
|
COMPREPLY=( $( compgen -W '${changed[@]:-} \
|
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
|
|
|
${newremoved[@]:-}' -- "$cur" ) )
|
2009-06-05 08:41:27 +02:00
|
|
|
else
|
|
|
|
COMPREPLY=( $(compgen $default -- "$cur") )
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
COMPREPLY=( $( compgen -W '-n -R -l -f -F -m -r' -- \
|
|
|
|
$cur ) )
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
cvsroot)
|
|
|
|
if [ -r ~/.cvspass ]; then
|
|
|
|
# Ugly escaping because of bash treating ':' specially
|
|
|
|
cvsroots=$( sed 's/^[^ ]* //; s/:/\\:/g' ~/.cvspass )
|
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 '$cvsroots' -- "$cur" ) )
|
2009-06-05 08:41:27 +02:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
export)
|
|
|
|
if [[ "$cur" != -* ]]; then
|
|
|
|
[ -z "$cvsroot" ] && cvsroot=$CVSROOT
|
|
|
|
COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) )
|
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 '${COMPREPLY[@]}' -- "$cur" ) )
|
2009-06-05 08:41:27 +02:00
|
|
|
else
|
|
|
|
COMPREPLY=( $( compgen -W '-N -f -l -R -n \
|
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
|
|
|
-r -D -d -k' -- "$cur" ) )
|
2009-06-05 08:41:27 +02:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
diff)
|
|
|
|
if [[ "$cur" == -* ]]; then
|
|
|
|
_longopt diff
|
|
|
|
else
|
|
|
|
get_entries
|
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 '${entries[@]:-}' -- "$cur" ) )
|
2009-06-05 08:41:27 +02:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
remove)
|
|
|
|
if [[ "$cur" != -* ]]; then
|
|
|
|
set_prefix
|
|
|
|
if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
|
|
|
|
get_entries
|
|
|
|
# find out what files are missing
|
|
|
|
for i in "${entries[@]}"; do
|
|
|
|
[ ! -r "$i" ] && miss=( "${miss[@]}" $i )
|
|
|
|
done
|
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 '${miss[@]:-}' -- "$cur") )
|
2009-06-05 08:41:27 +02:00
|
|
|
fi
|
|
|
|
else
|
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 '-f -l -R' -- "$cur" ) )
|
2009-06-05 08:41:27 +02:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
import)
|
|
|
|
if [[ "$cur" != -* ]]; then
|
|
|
|
# starts with same algorithm as checkout
|
|
|
|
[ -z "$cvsroot" ] && cvsroot=$CVSROOT
|
|
|
|
prefix=${cur%/*}
|
|
|
|
if [ -r ${cvsroot}/${prefix} ]; then
|
|
|
|
get_modules
|
|
|
|
COMPREPLY=( ${COMPREPLY[@]#$cvsroot} )
|
|
|
|
COMPREPLY=( ${COMPREPLY[@]#\/} )
|
|
|
|
fi
|
|
|
|
pwd=$( pwd )
|
|
|
|
pwd=${pwd##*/}
|
|
|
|
COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $pwd' -- \
|
|
|
|
$cur ) )
|
|
|
|
else
|
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 '-d -k -I -b -m -W' -- "$cur" ))
|
2009-06-05 08:41:27 +02:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
update)
|
|
|
|
if [[ "$cur" = -* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '-A -P -C -d -f -l -R -p \
|
|
|
|
-k -r -D -j -I -W' -- \
|
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-06-05 08:41:27 +02:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
"")
|
|
|
|
COMPREPLY=( $( compgen -W 'add admin annotate checkout ci co \
|
|
|
|
commit diff delete edit export \
|
|
|
|
freeze get history import log new \
|
|
|
|
patch rcs rdiff release remove \
|
|
|
|
rfreeze rlog rm rtag stat status \
|
|
|
|
tag unedit up update -H -Q -q -b \
|
|
|
|
-d -e -f -l -n -t -r -v -w -x -z \
|
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
|
|
|
--help --version' -- "$cur" ) )
|
2009-06-05 08:41:27 +02:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
complete -F _cvs $default cvs
|
|
|
|
}
|
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
|