From 8c9b4d9000224b81c104eed450b308b065c9d6fd Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Thu, 12 Mar 2020 18:34:42 +0100 Subject: [PATCH] completions/systemctl: Remove annoying marker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- share/functions/_fish_systemctl.fish | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/functions/_fish_systemctl.fish b/share/functions/_fish_systemctl.fish index 669bd41e5..a4e36ae3a 100644 --- a/share/functions/_fish_systemctl.fish +++ b/share/functions/_fish_systemctl.fish @@ -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