aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/__fish_complete_job_pids.fish
blob: 056e061f64a1ce0211262865f722bad45ef07015 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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