mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
parent
6ab2d78936
commit
9c6e81a838
3 changed files with 11 additions and 3 deletions
|
@ -5,6 +5,6 @@ function __fish_complete_pids -d "Print a list of process identifiers along with
|
|||
|
||||
# Display the tty if available
|
||||
# But not if it's just question marks, meaning no tty
|
||||
ps axc -o pid,ucomm,tty | string match -r -v '^\s*'$fish_pid'\s' | tail -n +2 | string replace -r ' *([0-9]+) +([^ ].*[^ ]|[^ ]) +([^ ]+) *$' '$1\t$2 [$3]' | string replace -r ' *\[\?*\] *$' ''
|
||||
__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 ' *\[\?*\] *$' ''
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
function __fish_complete_proc
|
||||
function __fish_complete_proc --inherit-variable ps
|
||||
# "comm=" means "print comm field with an empty name", which causes the header to be removed.
|
||||
# On many systems, comm is truncated (e.g. on Linux it's 15 chars),
|
||||
# but that's okay since commands that accept them as argument also only use those (e.g. pgrep).
|
||||
# String removes zombies (ones in parentheses) and padding (macOS adds some apparently).
|
||||
ps -axc -o comm= | string match -rv '\(.*\)' | string trim
|
||||
__fish_ps -o comm= | string match -rv '\(.*\)' | string trim
|
||||
end
|
||||
|
|
8
share/functions/__fish_ps.fish
Normal file
8
share/functions/__fish_ps.fish
Normal file
|
@ -0,0 +1,8 @@
|
|||
function __fish_ps
|
||||
switch (realpath (command -v ps) | string match -r '[^/]+$')
|
||||
case busybox
|
||||
command ps $argv
|
||||
case '*'
|
||||
command ps axc $argv
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue