Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix proc/pid completion in OS X #129

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions share/functions/__fish_complete_pids.fish
@@ -1,8 +1,12 @@
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
ps --no-heading -o pid,comm,tty --ppid %self -N | sed -r 's/ *([0-9]+) +([^ ].*[^ ]|[^ ]) +([^ ]+)$/\1'\t'\2 [\3]/' ^/dev/null
if test (uname) = Darwin
pgrep -l -v -P %self | sed 's/ /'\t'/'
else
# This may be a bit slower, but it's nice - having the tty displayed is really handy
ps --no-heading -o pid,comm,tty --ppid %self -N | sed -r 's/ *([0-9]+) +([^ ].*[^ ]|[^ ]) +([^ ]+)$/\1'\t'\2 [\3]/' ^/dev/null

# If the above is too slow, this is faster but a little less useful
# pgrep -l -v -P %self | sed 's/ /'\t'/'
# If the above is too slow, this is faster but a little less useful
# pgrep -l -v -P %self | sed 's/ /'\t'/'
end
end

6 changes: 5 additions & 1 deletion share/functions/__fish_complete_proc.fish
@@ -1,3 +1,7 @@
function __fish_complete_proc --description 'Complete by list of running processes'
ps a --no-headers --format comm | sort -u
if test (uname) = Darwin
ps -ao ucomm | awk 'FNR==1 { next } { gsub(/ +$/,"") } 1' | sort -u
else
ps a --no-headers --format comm | sort -u
end
end