mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-05 23:11:11 +02:00
add completion of globbing flags
This commit is contained in:
parent
399cf6312e
commit
5d13deda4e
5 changed files with 48 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
2008-11-08 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* 26017: Completion/Unix/Type/_path_files,
|
||||
Completion/Zsh/Type/_globflags, Completion/Zsh/Type/_globquals:
|
||||
add completion of globbing flags
|
||||
|
||||
2008-11-08 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* 26021: Completion/Unix/Type/_path_files: complete glob
|
||||
|
|
|
@ -21,7 +21,11 @@ if [[ ( -o bareglobqual && \
|
|||
$PREFIX = (#b)((*[^\\]|)(\\\\)#"(#q")([^\)]#) \
|
||||
) && -z $compstate[quote] ]]; then
|
||||
compset -p ${#match[1]}
|
||||
_globquals
|
||||
if [[ -o extendedglob ]] && compset -P '\#'; then
|
||||
_globflags
|
||||
else
|
||||
_globquals
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ _delimiters
|
|||
_directory_stack
|
||||
_file_descriptors
|
||||
_functions
|
||||
_globflags
|
||||
_globqual_delims
|
||||
_globquals
|
||||
_history_modifiers
|
||||
|
|
33
Completion/Zsh/Type/_globflags
Normal file
33
Completion/Zsh/Type/_globflags
Normal file
|
@ -0,0 +1,33 @@
|
|||
local ret=1
|
||||
local -a flags
|
||||
|
||||
if compset -P a; then
|
||||
_message -e numbers 'errors'
|
||||
return
|
||||
elif compset -P q; then
|
||||
_globquals
|
||||
return
|
||||
fi
|
||||
|
||||
flags=(
|
||||
'i:case insensitive'
|
||||
'l:lower case characters match uppercase'
|
||||
'I:case sensitive matching'
|
||||
's:match start of string'
|
||||
'e:match end of string'
|
||||
)
|
||||
[[ $compstate[context] = condition ]] && flags+=(
|
||||
'b:activate backreferences'
|
||||
'B:deactivate backreferences'
|
||||
'm:set reference to entire matched data'
|
||||
'M:deactivate m flag'
|
||||
)
|
||||
|
||||
_describe -t globflags "glob flag" flags -Q -S ')' && ret=0
|
||||
flags=(
|
||||
'a:approximate matching'
|
||||
'q:introduce glob qualifier'
|
||||
)
|
||||
_describe -t globflags "glob flag" flags -Q -S '' && ret=0
|
||||
|
||||
return ret
|
|
@ -25,7 +25,7 @@ while [[ -n $PREFIX ]]; do
|
|||
return
|
||||
elif ! _globqual_delims; then
|
||||
# still completing mode spec
|
||||
_message "mode spec"
|
||||
_message -e modes "mode spec"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
@ -57,7 +57,7 @@ while [[ -n $PREFIX ]]; do
|
|||
(d)
|
||||
# complete/skip device
|
||||
if ! compset -p '[[:digit:]]##'; then
|
||||
_message "device ID"
|
||||
_message -e device-ids "device ID"
|
||||
return
|
||||
fi
|
||||
;;
|
||||
|
@ -65,7 +65,7 @@ while [[ -n $PREFIX ]]; do
|
|||
(l)
|
||||
# complete/skip link count
|
||||
if ! compset -P '([-+]|)[[:digit:]]##'; then
|
||||
_message "link count"
|
||||
_message -e numbers "link count"
|
||||
return
|
||||
fi
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue