2006-02-12 21:14:21 +08:00
|
|
|
function __fish_complete_pids -d "Print a list of process identifiers along with brief descriptions"
|
2016-11-28 13:27:22 +08:00
|
|
|
# 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
|
2018-03-16 07:31:15 +08:00
|
|
|
# $fish_pid is removed from output by string match -r -v
|
2016-11-28 13:27:22 +08:00
|
|
|
|
|
|
|
# Display the tty if available
|
|
|
|
# But not if it's just question marks, meaning no tty
|
2020-04-19 11:05:16 +08:00
|
|
|
__fish_ps -o pid,comm,tty | string match -r -v '^\s*'$fish_pid'\s' | tail -n +2 | string replace -r ' *([0-9]+) +([^ ].*[^ ]|[^ ]) +([^ ]+) *$' '$1\t$2 [$3]' | string replace -r ' *\[\?*\] *$' ''
|
2006-02-12 21:14:21 +08:00
|
|
|
end
|