mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-21 03:21:16 -03:00
Unset SYSTEMD_COLORS for systemd completion
Fixes an issue where systemctl and other systemd commands completions are prefixed by ANSI color escape codes
This commit is contained in:
committed by
Peter Ammon
parent
bf2f7ee6c0
commit
7a668fb17e
@@ -1,4 +1,7 @@
|
||||
function __fish_systemctl --description 'Call systemctl with some options from the current commandline'
|
||||
# We don't want to complete with ANSI color codes
|
||||
set -lu SYSTEMD_COLORS
|
||||
|
||||
# These options are all global - before or after subcommand/arguments.
|
||||
# There's a bunch of long-only options in here, so we need to be creative with the mandatory short version.
|
||||
set -l opts t/type= s-state= p/property= a/all
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
function __fish_systemctl_services
|
||||
# We don't want to complete with ANSI color codes
|
||||
set -lu SYSTEMD_COLORS
|
||||
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
systemctl --user list-unit-files --full --no-legend --no-pager --plain --type=service 2>/dev/null $argv | string split -f 1 ' '
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
# Like for running machines, I'm assuming machinectl doesn't allow spaces in image names
|
||||
# This does not include the special image ".host" since it isn't valid for most operations
|
||||
function __fish_systemd_machine_images
|
||||
# We don't want to complete with ANSI color codes
|
||||
set -lu SYSTEMD_COLORS
|
||||
|
||||
machinectl --no-legend --no-pager list-images | while read -l a b
|
||||
echo $a
|
||||
end
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
# It seems machinectl will eliminate spaces from machine names so we don't need to handle that
|
||||
function __fish_systemd_machines
|
||||
# We don't want to complete with ANSI color codes
|
||||
set -lu SYSTEMD_COLORS
|
||||
|
||||
machinectl --no-legend --no-pager list --all | while read -l a b
|
||||
echo $a
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user