From c2c4fbf206a6d6b61dcec21b2a4afab91bfe2c17 Mon Sep 17 00:00:00 2001 From: Daniel Matz Date: Tue, 24 Nov 2015 20:30:25 -0600 Subject: [PATCH] Add a function to complete job PIDs. --- share/functions/__fish_complete_job_pids.fish | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 share/functions/__fish_complete_job_pids.fish diff --git a/share/functions/__fish_complete_job_pids.fish b/share/functions/__fish_complete_job_pids.fish new file mode 100644 index 000000000..056e061f6 --- /dev/null +++ b/share/functions/__fish_complete_job_pids.fish @@ -0,0 +1,13 @@ +function __fish_complete_job_pids --description "Print a list of job PIDs and their commands" + if set -l jobpids (jobs -p) + # when run at the commandline, the first line of output is a header, but + # that doesn't seem to be printed when you run jobs in a subshell + + # then we can use the jobs command again to get the corresponding + # command to provide as a description for each job PID + for jobpid in $jobpids + set -l cmd (jobs -c $jobpid) + printf "%s\tJob: %s\n" $jobpid $cmd + end + end +end