pcp
[Top] [All Lists]

PCP zsh completions

To: pcp developers <pcp@xxxxxxxxxxx>
Subject: PCP zsh completions
From: Marko Myllynen <myllynen@xxxxxxxxxx>
Date: Wed, 11 May 2016 14:58:33 +0300
Delivered-to: pcp@xxxxxxxxxxx
Organization: Red Hat
Reply-to: Marko Myllynen <myllynen@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0
Hi,

Good news, I've created zsh completions for PCP which cover most used
command line clients. If you can think of any client which is not yet
covered, suggestions (and patches) are warmly welcome.

Having used these myself for a week or so I see that my usage patterns
are changing. For instance, if I'm about to investigate process related
metrics from an archive, I don't anymore use one utility first to check
what's available and then pmrep or such to display the values. Rather, I
let zsh to do the work for me: pmrep -a test-archive proc<TAB> shows the
proc metrics available in that particular archive and offers completions
only for them, I can then instantly proceed on investigating the values
I'm interested in, no need to guess what's in it or to use several steps
for one task any more.

Features/completions which are typical for any zsh completions are
naturally supported where applicable (so while these might sound
advanced for some people, these are business as usual for zsh users):

* paths
* users
* hosts
* pids
* timezones
* file descriptors
* selective completion for options
  - e.g. don't offer anything after --help as it would be pointless

These completions are PCP specific:

* support for relevant metrics
  - pminfo <tab> is different than pminfo -h somehost <tab> or pminfo
    -a somearchive <tab>. Can be configured with zstyles to offer full
    names (the default) or partial completion (so pminfo <tab> will
    not offer all the 1000+ metrics but only the ~20-30 high level
    branches)
  - support derived metrics as well
* support for relevant instances
  - pmval kernel.all.load -i <tab> will offer only the instances of
    kernel.all.load but pmval -i <tab> offers all instances since zsh
    can't yet read the user's mind for the metric s/he's thinking of
* support for pmrep metricsets
  - pmrep --config ./pmrep.conf :<tab> offers the metricsets specified
    in that particular configuration file
* offer archive names, not archive files when completing
  - if you have the usual files 20160510.{0,meta,index} in a directory,
    just offer 20160510 with -a/--archive, others wouldn't work anyway
  - supports also multi-archive specification
* recognize mutually exclusive options
  - offer only one of -a/--container/-h/-L, offer -K only with -L,
    don't offer -Z if -z is already present, etc
* offer running containers for --container
  - by default offers names, can be configured with zstyles to offer
    IDs (but in both cases recognizes both if needed)
* recognize -K/--spec-local keywords
  - -K <tab> offers: add del clear
* recognize pmfind mechanisms and services
* recognize pmiostat aggregation methods
* recognize pmiostat extended options
* recognize pmrep output alternatives
* recognize scaling options for pmrep
  - so pmrep -b <tab> offers KB, MB, GB, and so, and pmrep -q <tab>
    offers those hard to know counter scaling options the right way
* recognize pcp subcommands
* recognize commands supporting multiple -a/-h/-H
* offer font families with pmchart -f <tab>

Like the bash completions, it would be nice to have this part of the pcp
package and install the file under /usr/share/zsh/site-functions. Since
the previous email got lost somewhere before hitting the list, I'm not
attaching the file this time but providing it here:

https://myllynen.fedorapeople.org/_pcp

Thanks,

-- 
Marko Myllynen

<Prev in Thread] Current Thread [Next in Thread>