make perl completion a bit more consistant with other, by first dealing
with options, then with main arguments
This commit is contained in:
parent
47d0c5be2c
commit
9e08218fb9
@ -5361,16 +5361,12 @@ _perl()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# handle case where first parameter is not a dash option
|
if [[ "$cur" == -* ]]; then
|
||||||
if [[ "`_get_cword`" != -* ]]; then
|
COMPREPLY=( $( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d \
|
||||||
|
-D -p -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- $cur ) )
|
||||||
|
else
|
||||||
_filedir
|
_filedir
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# complete using basic options
|
|
||||||
COMPREPLY=( $( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d -D -p \
|
|
||||||
-n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- $cur ) )
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
complete -F _perl $nospace $filenames perl
|
complete -F _perl $nospace $filenames perl
|
||||||
|
|
||||||
@ -5427,21 +5423,15 @@ _perldoc()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case $cur in
|
if [[ "$cur" == -* ]]; then
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- $cur ))
|
COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- $cur ))
|
||||||
return 0
|
else
|
||||||
;;
|
# return available modules (unless it is clearly a file)
|
||||||
*/*)
|
if [[ "$cur" != */* ]]; then
|
||||||
return 0
|
_perlmodules
|
||||||
;;
|
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '$( PAGER=/bin/cat man perl | sed -ne "/perl.*Perl overview/,/perlwin32/p" | awk "\$NF=2 { print \$1}" | grep perl )' -- $cur ) )
|
||||||
*)
|
fi
|
||||||
_perlmodules
|
fi
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '$( PAGER=/bin/cat man perl | sed -ne "/perl.*Perl overview/,/perlwin32/p" | awk "\$NF=2 { print \$1}" | grep perl )' -- $cur ) )
|
|
||||||
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
}
|
||||||
complete -F _perldoc $default perldoc
|
complete -F _perldoc $default perldoc
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user