mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 15:37:59 +08:00
completions/sv: Use path
This commit is contained in:
parent
05e7732cb8
commit
32715ee504
|
@ -11,20 +11,13 @@ set -l commands \
|
||||||
try-restart check
|
try-restart check
|
||||||
|
|
||||||
function __fish_complete_sv_list_services
|
function __fish_complete_sv_list_services
|
||||||
set -l svdir
|
set -l svdir (path filter -d -- $SVDIR \
|
||||||
for candidate_svdir in \
|
|
||||||
"$SVDIR" \
|
|
||||||
/run/runit/runsvdir/current \
|
/run/runit/runsvdir/current \
|
||||||
/run/runit/service \
|
/run/runit/service \
|
||||||
/etc/services \
|
/etc/services \
|
||||||
/services
|
/services)
|
||||||
if test -d $candidate_svdir
|
|
||||||
set svdir $candidate_svdir
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
set -q svdir[1]; or return
|
set -q svdir[1]; or return
|
||||||
set -l services (command ls $svdir)
|
set -l services (path basename -- $svdir[1]/*)
|
||||||
set -l sv_status (sv status $services 2>/dev/null |
|
set -l sv_status (sv status $services 2>/dev/null |
|
||||||
string replace -ar ';.*$' '')
|
string replace -ar ';.*$' '')
|
||||||
and string replace -r "^(\w+: )(.*?):" '$2\t$1' $sv_status
|
and string replace -r "^(\w+: )(.*?):" '$2\t$1' $sv_status
|
||||||
|
|
Loading…
Reference in New Issue
Block a user