File: __fish_complete_pids.fish

package info (click to toggle)
fish 3.1.2-3%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 38,672 kB
  • sloc: ansic: 80,259; cpp: 47,069; javascript: 17,087; sh: 6,163; python: 3,429; makefile: 669; perl: 367; objc: 78; xml: 18
file content (10 lines) | stat: -rw-r--r-- 619 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
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
    #  $fish_pid is removed from output by string match -r -v

    # 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 ' *\[\?*\] *$' ''
end