summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2011-08-20 11:19:42 +0300
committerVille Skyttä <ville.skytta@iki.fi>2011-08-20 11:19:42 +0300
commitbff86775992a2e321863dfe38a9f0b1f4a8f471d (patch)
tree805046d0b287286246159b2fe5f620f627f5be48
parent93f786c6fdb0143c9a02502855487c01799a55b1 (diff)
downloadbash-completion-bff86775992a2e321863dfe38a9f0b1f4a8f471d.tar.gz
gprof: New non-generic completion.
Neither _longopt, _parse_help, or _parse_usage do a very good job at all parsing gprof's --help output.
-rw-r--r--bash_completion2
-rw-r--r--completions/Makefile.am1
-rw-r--r--completions/gprof71
3 files changed, 73 insertions, 1 deletions
diff --git a/bash_completion b/bash_completion
index bb65f2cb..bb91f68f 100644
--- a/bash_completion
+++ b/bash_completion
@@ -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 \
diff --git a/completions/Makefile.am b/completions/Makefile.am
index 0ded57a6..038959e2 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -60,6 +60,7 @@ bashcomp_DATA = abook \
gnome-mplayer \
gpg \
gpg2 \
+ gprof \
gzip \
hddtemp \
heimdal \
diff --git a/completions/gprof b/completions/gprof
new file mode 100644
index 00000000..6c0aa78b
--- /dev/null
+++ b/completions/gprof
@@ -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