From c21b91b916e23f202a0ae3b2a7aafe4e595e7b5c Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Mon, 23 Aug 1999 10:07:44 +0000 Subject: Initial revision --- Completion/User/_dir_list | 4 ++++ Completion/User/_exec_funcs | 49 +++++++++++++++++++++++++++++++++++++++++++++ Completion/User/_gprof | 12 +++++++++++ Completion/User/_users | 6 ++++++ 4 files changed, 71 insertions(+) create mode 100644 Completion/User/_dir_list create mode 100644 Completion/User/_exec_funcs create mode 100644 Completion/User/_gprof create mode 100644 Completion/User/_users (limited to 'Completion/User') diff --git a/Completion/User/_dir_list b/Completion/User/_dir_list new file mode 100644 index 000000000..8e3615dac --- /dev/null +++ b/Completion/User/_dir_list @@ -0,0 +1,4 @@ +#autoload + +compset -P '*:' +_files -S: -r ': \t\t\-' -/ diff --git a/Completion/User/_exec_funcs b/Completion/User/_exec_funcs new file mode 100644 index 000000000..2fd64b230 --- /dev/null +++ b/Completion/User/_exec_funcs @@ -0,0 +1,49 @@ +#autoload + +# This should be called from `_arguments' or otherwise the calling +# function has to set up an array named `line' that contains the +# name of the executable as its seconf element or it has to supply +# that name as an argument. +# One option is recognized: `-p' means that we are completing a pair +# of names separated by a slash. + +local cmd pair expl + +if [[ "$1" = -p ]]; then + pair=yes + shift +fi + +if (( $# )); then + cmd="$1" +elif [[ $#line -gt 1 ]]; then + cmd="$line[2]" +else + return 1 +fi + +if [[ -n "$cmd" ]]; then + if [[ "$cmd" = /* ]]; then + tmp="$cmd" + else + tmp="$PWD/$cmd" + fi + + if [[ "$tmp" != "$_es_command" ]]; then + _es_command="$tmp" + _es_funcs=( "${(@)${(@M)${(@f)$(nm $cmd)}:#[^ ]# [tT] ([^_]|_[^_])*}##* }" ) + fi + + if [[ -n "$pair" ]]; then + if compset -P '*/'; then + _description expl 'call arc to function' + else + _description expl 'call arc from function' + fi + else + _description expl function + fi + compadd -M 'r:|_=* r:|=*' - "$_es_funcs[@]" +else + return 1 +fi diff --git a/Completion/User/_gprof b/Completion/User/_gprof new file mode 100644 index 000000000..0a1d621be --- /dev/null +++ b/Completion/User/_gprof @@ -0,0 +1,12 @@ +#compdef gprof + +_arguments -s -{a,b,c,D,h,i,l,L,s,T,v,w,x,y,z} \ + -{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,Z}:'function name: _exec_funcs' \ + '-I:directory:_dir_list' \ + '-d-:debug level:' '-k:function names: _exec_funcs -p' \ + '-m:minimum execution count:' \ + ':executable:_files -g *(*)' \ + ':profile file:_files -g gmon.*' \ + -- -s '(#--[no-] --)' \ + '*=name*:function name: _exec_funcs' \ + '*=dirs*:directory:_dir_list' diff --git a/Completion/User/_users b/Completion/User/_users new file mode 100644 index 000000000..fc1e87e52 --- /dev/null +++ b/Completion/User/_users @@ -0,0 +1,6 @@ +#autoload + +local expl + +_description expl user +compgen "$@" "$expl[@]" -u -- cgit 1.4.1