mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-30 14:24:35 +08:00
completions/systemctl: Remove annoying marker
The output of systemctl list-units seems to include a marker of '●' or '*' for some units, even if the output is not going to a terminal and "--no-legend" and "--no-pager" are given. This appears to be a recent development, and there does not appear to be a flag to disable it. So we simply filter it out in the completions to once again hopefully offer the actual units. Fixes #6740
This commit is contained in:
parent
62525ab6b2
commit
8c9b4d9000
|
@ -74,11 +74,12 @@ function _fish_systemctl --description 'Call systemctl with some options from th
|
|||
# Output looks like
|
||||
# systemd-tmpfiles-clean.timer [more whitespace] loaded active waiting Daily Cleanup[...]
|
||||
# Use the last part as the description.
|
||||
systemctl --no-legend --no-pager --all list-units $passflags | string replace -r "(?: +(\S+)){4}" \t'$1'
|
||||
# Note that in some cases this prints a "●" or "*" (with C locale) marker at the beginning of the line. We have to remove it.
|
||||
systemctl --no-legend --no-pager --all list-units $passflags | string trim -c ' *●' | string replace -r "(?: +(\S+)){4}" \t'$1'
|
||||
# We need this for disabled/static units. Also instance units without an active instance.
|
||||
# Output looks like
|
||||
# systemd-tmpfiles-clean.timer static
|
||||
# Just use the state as the description, since we won't get it here.
|
||||
# This is an issue for units that appear in both.
|
||||
systemctl --no-legend --no-pager --all list-unit-files $passflags | string replace -r "(?: +(\S+)){1}" \t'$1'
|
||||
systemctl --no-legend --no-pager --all list-unit-files $passflags | string trim -c ' *●' | string replace -r "(?: +(\S+)){1}" \t'$1'
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user