From a0233a74e3677941f07bf4efba3cbd6fd3e9b918 Mon Sep 17 00:00:00 2001 From: Jun-ichi Takimoto Date: Mon, 25 Jun 2018 11:04:31 +0900 Subject: 43079, 43086: new utility to complete names of running processes And new completions for dtruss, fs_usage and sc_usage. --- Completion/Darwin/Command/_fs_usage | 28 ++++++++++++++++++++++++++++ Completion/Darwin/Command/_sc_usage | 10 ++++++++++ 2 files changed, 38 insertions(+) create mode 100644 Completion/Darwin/Command/_fs_usage create mode 100644 Completion/Darwin/Command/_sc_usage (limited to 'Completion/Darwin') diff --git a/Completion/Darwin/Command/_fs_usage b/Completion/Darwin/Command/_fs_usage new file mode 100644 index 000000000..956816169 --- /dev/null +++ b/Completion/Darwin/Command/_fs_usage @@ -0,0 +1,28 @@ +#compdef fs_usage + +local curcontext="$curcontext" state state_descr line ret=1 +typeset -A opt_args + +_arguments -s -C -A '-*' : \ + '-e[exclude fs_usage and the specified processes from sampling]' \ + '-w[use wider output]' \ + '*-f+[specify output filtering mode]:mode:(nework filesys pathname exec diskio cachehit)' \ + '-b[annotate disk I/O events with BootCache info]' \ + '(-R -S -E)-t+[specify run timeout]:seconds' \ + '(-t)-R+[specify raw trace file to process]:raw trace file:_files' \ + '(-t)-S+[specify time to begin processing the trace file]:seconds' \ + '(-t)-E+[specify time to stop processing the trace file]:seconds' \ + '*: :->pid-or-pname' && ret=0 + +case $state in + (pid-or-pname) + if [[ -z $opt_args[-R] ]]; then + _alternative "processes:: _pids" \ + "processes-names:: _process_names -a" && ret=0 + else + _message 'pid or process name in the trace file' && ret=0 + fi + ;; +esac + +return ret diff --git a/Completion/Darwin/Command/_sc_usage b/Completion/Darwin/Command/_sc_usage new file mode 100644 index 000000000..3a11a1bff --- /dev/null +++ b/Completion/Darwin/Command/_sc_usage @@ -0,0 +1,10 @@ +#compdef sc_usage + +_arguments -s -A '-*' : \ + '-c+[specify code file to use]:code file:_files' \ + '-e[sort output by call count]' \ + '-l[use scrolling output style instead of window updating style]' \ + '-s+[specify sampling interval]:seconds' \ + '(- :)-E[specify command path and args to excute]: :_absolute_command_paths:*:: :_normal' \ + '1: : _alternative "processes:: _pids" + "processes-names:: _process_names -a"' -- cgit 1.4.1