perldoc: Add some option arg completions, use _parse_help.
This commit is contained in:
parent
bcf41c74c2
commit
a958ccde50
@ -99,16 +99,22 @@ _perldoc()
|
|||||||
local perl="${1%doc}"
|
local perl="${1%doc}"
|
||||||
[[ $perl == $1 ]] || ! type $perl &>/dev/null && perl=
|
[[ $perl == $1 ]] || ! type $perl &>/dev/null && perl=
|
||||||
|
|
||||||
# complete builtin perl functions
|
|
||||||
case $prev in
|
case $prev in
|
||||||
|
-h|-V|-n|-o|-M|-w|-L)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-d)
|
||||||
|
_filedir
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
-f)
|
-f)
|
||||||
_perlfunctions $perl
|
_perlfunctions $perl
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- "$cur" ))
|
COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) )
|
||||||
else
|
else
|
||||||
# return available modules (unless it is clearly a file)
|
# return available modules (unless it is clearly a file)
|
||||||
if [[ "$cur" != @(*/|[.~])* ]]; then
|
if [[ "$cur" != @(*/|[.~])* ]]; then
|
||||||
|
@ -24,17 +24,10 @@ expect {
|
|||||||
-re /@ { unresolved "$test" }
|
-re /@ { unresolved "$test" }
|
||||||
default { unresolved "$test" }
|
default { unresolved "$test" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sync_after_int
|
sync_after_int
|
||||||
|
|
||||||
set test "- should complete options"
|
|
||||||
set options {
|
|
||||||
-h -v -t -u -m -l -F -X -f -q
|
|
||||||
}
|
|
||||||
assert_complete $options "perldoc -" $test
|
|
||||||
|
|
||||||
|
|
||||||
|
assert_complete_any "perldoc -"
|
||||||
sync_after_int
|
sync_after_int
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user