From ef3602167e8c72cadfc328cf3b1bd7b47a2646cd Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Thu, 1 Feb 2024 15:28:03 +0100 Subject: [PATCH] Fix bash-completions dir Add color to autostart-manage info --- autoinstall/file_command.sh | 7 +++++-- autostart-manage/lib/common.sh | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/autoinstall/file_command.sh b/autoinstall/file_command.sh index 09ff198..bfea98f 100644 --- a/autoinstall/file_command.sh +++ b/autoinstall/file_command.sh @@ -33,8 +33,11 @@ then if [ -n "$completions" ] then echo "Installing completions for $exe" - # shellcheck disable=SC2086 - "$target" $completions > "$XDG_CONFIG_HOME/completionsrc.d/_$(basename "$exe")" + + # path taken from "__load_completion" function + bash_completions_dir=${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions + mkdir -p "$bash_completions_dir" + eval "$target $completions" > "$bash_completions_dir/_$(basename "$exe")" fi fi diff --git a/autostart-manage/lib/common.sh b/autostart-manage/lib/common.sh index dfbbb1c..2479fe1 100644 --- a/autostart-manage/lib/common.sh +++ b/autostart-manage/lib/common.sh @@ -41,10 +41,24 @@ _autostart_run_graphical () { _echo_table () { for unit in "$@" do + if _systemctl "$unit" is-enabled --quiet + then + _enabled=$(green "enabled") + else + _enabled=$(red "disabled") + fi + + if _systemctl "$unit" is-active --quiet + then + _active=$(green "active") + else + _active=$(red "inactive") + fi + printf "%s\t%s\t%s\t%s\n" \ "$unit" \ - "$(_systemctl "$unit" is-enabled)" \ - "$(_systemctl "$unit" is-active)" \ + "$_enabled" \ + "$_active" \ "$(_get_autostart_cmd "$unit")" done }