[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-425-gbff8677

Ville Skyttä ville.skytta at iki.fi
Sat Aug 20 08:20:38 UTC 2011


The following commit has been merged in the master branch:
commit bff86775992a2e321863dfe38a9f0b1f4a8f471d
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sat Aug 20 11:19:42 2011 +0300

    gprof: New non-generic completion.
    
    Neither _longopt, _parse_help, or _parse_usage do a very good job at
    all parsing gprof's --help output.

diff --git a/bash_completion b/bash_completion
index bb65f2c..bb91f68 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 0ded57a..038959e 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 0000000..6c0aa78
--- /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

-- 
bash-completion



More information about the Bash-completion-commits mailing list