From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25986 invoked by alias); 31 Jul 2016 11:05:21 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 38976 Received: (qmail 4277 invoked from network); 31 Jul 2016 11:05:21 -0000 X-Qmail-Scanner-Diagnostics: from cdptpa-outbound-snat.email.rr.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(107.14.166.227):SA:0(0.0/5.0):. Processed in 0.199842 secs); 31 Jul 2016 11:05:21 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: andy@pileus.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at a._spf.rr.com designates 107.14.166.227 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pileus.org; s=mail; h=Content-Type:MIME-Version:Message-ID:Subject:To:From:Date:Sender: Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=AhRfEMz49hxo4hU868EusrH9GhbzKWctBprqZVaQD4I=; b=NJ7hgbatJ+rsAg6XMSzTPvnWAs GnlQCUaFAYt3U0CSeVNfn3mYeI2OUQQDBpZQ0Vevl4iUSEyowNL9JM8eAWbD5GjfMAhgondgEPmEW q4RS/ZKVTjA5uI2cpvb8ZARGx02GVl7Mqn1F3Duh3RIjgRRPyUVJud4FzA4o/t7Qv0kU=; Date: Sun, 31 Jul 2016 11:05:17 +0000 From: Andy Spencer To: zsh-workers@zsh.org Subject: [PATCH] Add completion for cpupower command Message-ID: <20160731110516.GA20521@pileus.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-RR-Connecting-IP: 107.14.168.118:25 X-Cloudmark-Score: 0 These are mostly static options with the exception of the frequency-set arguments for the governor and min/max frequencies, which are pulled from the output of frequency-info. --- Completion/Linux/_cpupower | 102 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 Completion/Linux/_cpupower diff --git a/Completion/Linux/_cpupower b/Completion/Linux/_cpupower new file mode 100644 index 0000000..406893e --- /dev/null +++ b/Completion/Linux/_cpupower @@ -0,0 +1,102 @@ +#compdef cpupower + +local -a ret state cmds args expl context line + +_arguments \ + '(-h --help)'{-h,--help}'[print usage information]' \ + '(-v --version)'{-v,--version}'[print package name and version]' \ + ':cmd:->cmds' \ + '*::arg:->args' && ret=0 + +case $state in + cmds) + cmds=( + 'frequency-info:show current frequency info' + 'frequency-set:set frequency parameters' + 'idle-info:show current idle state info' + 'idle-set:set idle state parameters' + 'info:show global power parameters' + 'set:set global power parameters' + 'monitor:report frequency and idle statistics' + 'help:print usage information' + ) + _describe cmd cmds && ret=0 + ;; + args) + args=( ) + case ${words[1]} in + frequency-info) + args+=( + '(-e --debug)'{-e,--debug}'[print debug info]' + '(-f --freq)'{-f,--freq}'[show current frequency]' + '(-w --hwfreq)'{-w,--hwfreq}'[show current hardware frequency]' + '(-l --hwlimits)'{-l,--hwlimits}'[show min/max frequency allowed]' + '(-d --driver)'{-d,--driver}'[show the kernel driver in use]' + '(-p --policy)'{-p,--policy}'[show the current cpufreq policy]' + '(-g --governors)'{-g,--governors}'[show available governers]' + '(-r --related-cpus)'{-a,--related-cpus}'[show cpus that run at the same frequency]' + '(-a --affected-cpus)'{-a,--affected-cpus}'[show software controlled cpus]' + '(-s --stats)'{-s,--stats}'[show cpufreq statistics]' + '(-y --latency)'{-y,--latency}'[show frequency change latency]' + '(-o --proc)'{-o,--proc}'[print old style proc info]' + '(-m --human)'{-m,--human}'[use human readable output]' + '(-n --no-rounding)'{-n,--no-rounding}'[disable rounding of values]' + ) + ;; + frequency-set) + args+=( + '(-d --min)'{-d,--min}'[new minimum frequency]:freq:->freq' + '(-u --max)'{-u,--max}'[new maximum frequency]:freq:->freq' + '(-g --governor)'{-g,--governor}'[new cpufreq governor]:gov:->gov' + '(-f --freq)'{-f,--freq}'[new frequency for userspace governor]:freq->freq' + '(-r --related)'{-r,--related}'[modify all hardware related cpus]' + ) + ;; + idle-info) + args+=( + '(-f --silent)'{-f,--silent}'[print summary only]' + '(-e --proc)'{-e,--proc}'[print old style proc info]' + ) + ;; + idle-set) + args+=( + '(-d --disable)'{-d,--disable}'[disable specific sleep state]:stateno' + '(-e --enable)'{-e,--enable}'[enable specific sleep state]:stateno' + '(-D --disable-by-latency)'{-D,--disable-by-latency}'[disable state based on latency]:latency' + '(-E --enable-all)'{-E,--enable-all}'[enable all idle states]' + ) + ;; + info) + args+=( + '(-b --perf-bias)'{-b,--perf-bias}'[show intel performance bias value]' + ) + ;; + set) + args+=( + '(-b --perf-bias)'{-b,--perf-bias}'[set intel performance bias value]:pbias' + ) + ;; + monitor) + args+=( + '-l[list available monitors]' + '-m[display the given monitors]:mon' + '-i[mesurement interval]:secs' + '-c[schedule on every core]' + '-v[increase verbosity]' + ) + ;; + esac + _arguments "${args[@]}" && ret=0 + case $state in + freq) + compadd $(cpupower frequency-info | + sed -n 's/ //g; s/,/ /g; s/availablefrequencysteps://p') + ;; + gov) + compadd $(cpupower frequency-info -g | sed 1d) + ;; + esac + ;; +esac + +return ret -- 2.7.3