Stringify many completions and functions, with --invert stringification.

I believe apm must have been buggy - example output that I found online
showed `tr` was mangling paths with spaces in it. Should be fixed.

Also, use dscl on OS X in __fish_complete_users.fish like
__fish_print_users.fish already does.
This commit is contained in:
Aaron Gyes
2016-04-08 10:46:51 +08:00
committed by David Adam
parent 790c7f80c7
commit 36691df6fe
17 changed files with 35 additions and 31 deletions

View File

@@ -1,11 +1,11 @@
function __fish_complete_pids -d "Print a list of process identifiers along with brief descriptions"
# This may be a bit slower, but it's nice - having the tty displayed is really handy
# 'tail -n +2' deletes the first line, which contains the headers
# 'grep -v...' removes self from the output
# %self is removed from output by string match -r -v
set -l SELF %self
# Display the tty if available
# But not if it's just question marks, meaning no tty
ps axc -o pid,ucomm,tty | grep -v '^\s*'$SELF'\s' | tail -n +2 | string replace -r ' *([0-9]+) +([^ ].*[^ ]|[^ ]) +([^ ]+) *$' '$1\t$2 [$3]' | string replace -r ' *\[\?*\] *$' ''
ps axc -o pid,ucomm,tty | string match -r -v '^\s*'$SELF'\s' | tail -n +2 | string replace -r ' *([0-9]+) +([^ ].*[^ ]|[^ ]) +([^ ]+) *$' '$1\t$2 [$3]' | string replace -r ' *\[\?*\] *$' ''
end