Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Completion for pgrep and pkill

I was surprised that this hadn't been written yet, so I used it as an opportunity to learn the completion system. A few things, though. The completion relies on ps, which I know takes arguments differently on different platforms. Without any cross-platform experience, I can't say whether or not the completion will work properly on a non-GNU system. Someone might need to go through and change it to be more portable.

Also, completions for IDs (group or user) are converted to their symbolic names if completed through menu selection. I'm not sure if this should be kept or not, as tab completion for a non-ambiguous numeric ID will no longer work. I suspect someone will want it removed.

Completion for pgrep's -d option (output delimiter) defaults to each character of IFS. If you tab through the completion menu, it displays space, null, tab, and carriage return properly as \  , $'\0', $'\t', and $'\r', but a newline is not $'\n' as expected. Instead, it is two single quotes with a newline in between. It's a minor annoyance to have the completion menu jump around while cycling through the list. The completion behaves even more strangely if you start with a quote.

Enjoy. :-)

Michael Hwang


Attachment: _pgrep
Description: Binary data

Messages sorted by: Reverse Date, Date, Thread, Author