gprof: New non-generic completion.

Neither _longopt, _parse_help, or _parse_usage do a very good job at
all parsing gprof's --help output.
This commit is contained in:
Ville Skyttä 2011-08-20 11:19:42 +03:00
parent 93f786c6fd
commit bff8677599
3 changed files with 73 additions and 1 deletions

View File

@ -1692,7 +1692,7 @@ _longopt()
}
# makeinfo and texi2dvi are defined elsewhere.
for i in a2ps awk base64 bash bc bison cat colordiff cp csplit \
cut date df diff dir du enscript env expand fmt fold gperf gprof \
cut date df diff dir du enscript env expand fmt fold gperf \
grep grub head indent irb ld ldd less ln ls m4 md5sum mkdir mkfifo mknod \
mv netstat nl nm objcopy objdump od paste patch pr ptx readelf rm rmdir \
sed seq sha{,1,224,256,384,512}sum shar sort split strip sum tac tail tee \

View File

@ -60,6 +60,7 @@ bashcomp_DATA = abook \
gnome-mplayer \
gpg \
gpg2 \
gprof \
gzip \
hddtemp \
heimdal \

71
completions/gprof Normal file
View File

@ -0,0 +1,71 @@
have gprof || return
_gprof()
{
local cur prev words cword split
_init_completion -s || return
case $cur in
-A*|-C*|-J*|-p*|-P*|-q*|-Q*|-n*|-N*|-d*)
return
;;
-S*)
cur=${cur:2}
_filedir
COMPREPLY=( "${COMPREPLY[@]/#/-S}" )
return
;;
-O*)
cur=${cur:2}
COMPREPLY=( $( compgen -P -O -W 'auto bsd 4.4bsd magic prof' \
-- "$cur" ) )
return
;;
esac
case $prev in
-I|--directory-path)
_filedir -d
return
;;
-R|--file-ordering|--external-symbol-table)
_filedir
return
;;
-w|--width|-k|-m|--min-count|-h|--help|-e|-E|-f|-F)
return
;;
--file-format)
COMPREPLY=( $( compgen -W 'auto bsd 4.4bsd magic prof' \
-- "$cur" ) )
return
;;
esac
$split && return
if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '--annotated-source --brief --exec-counts
--file-info --directory-path --no-annotated-source --print-path
--flat-profile --no-flat-profile --graph --no-graph --table-length=
--separate-files --no-exec-counts --function-ordering
--file-ordering --traditional --width= --all-lines --demangle
--no-demangle --no-static --static-call-graph
--ignore-non-functions -k --line --min-count= --time= --no-time=
--external-symbol-table= --display-unused-functions --debug --help
--file-format= --sum --version' -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
return
fi
_filedir
} &&
complete -F _gprof gprof
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh