From e2dd7c83f8ed095daede8c23b9de94349051db59 Mon Sep 17 00:00:00 2001 From: Aaron Kollasch Date: Fri, 28 Oct 2022 01:42:26 -0400 Subject: [PATCH] Reject unrecognized plugins in config Prevents duplication of preceding recognized plugin for each unrecognized plugin --- scripts/dracula.sh | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/scripts/dracula.sh b/scripts/dracula.sh index 49ddcef..394bd84 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -131,55 +131,45 @@ main() if [ $plugin = "git" ]; then IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-git-colors" "green dark_gray") script="#($current_dir/git.sh)" - fi - if [ $plugin = "battery" ]; then + elif [ $plugin = "battery" ]; then IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-battery-colors" "pink dark_gray") script="#($current_dir/battery.sh)" - fi - if [ $plugin = "gpu-usage" ]; then + elif [ $plugin = "gpu-usage" ]; then IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-gpu-usage-colors" "pink dark_gray") script="#($current_dir/gpu_usage.sh)" - fi - if [ $plugin = "cpu-usage" ]; then + elif [ $plugin = "cpu-usage" ]; then IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-cpu-usage-colors" "orange dark_gray") script="#($current_dir/cpu_info.sh)" - fi - if [ $plugin = "ram-usage" ]; then + elif [ $plugin = "ram-usage" ]; then IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-ram-usage-colors" "cyan dark_gray") script="#($current_dir/ram_info.sh)" - fi - if [ $plugin = "network" ]; then + elif [ $plugin = "network" ]; then IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-network-colors" "cyan dark_gray") script="#($current_dir/network.sh)" - fi - if [ $plugin = "network-bandwidth" ]; then + elif [ $plugin = "network-bandwidth" ]; then IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-network-bandwidth-colors" "cyan dark_gray") tmux set-option -g status-right-length 250 script="#($current_dir/network_bandwidth.sh)" - fi - if [ $plugin = "network-ping" ]; then + elif [ $plugin = "network-ping" ]; then IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-network-ping-colors" "cyan dark_gray") script="#($current_dir/network_ping.sh)" - fi - if [ $plugin = "spotify-tui" ]; then + elif [ $plugin = "spotify-tui" ]; then IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-spotify-tui-colors" "green dark_gray") script="#($current_dir/spotify-tui.sh)" - fi - if [ $plugin = "kubernetes-context" ]; then + elif [ $plugin = "kubernetes-context" ]; then IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-kubernetes-context-colors" "cyan dark_gray") script="#($current_dir/kubernetes_context.sh $show_kubernetes_context_label)" - fi - if [ $plugin = "weather" ]; then + elif [ $plugin = "weather" ]; then # wait unit $datafile exists just to avoid errors # this should almost never need to wait unless something unexpected occurs while [ ! -f $datafile ]; do @@ -188,9 +178,8 @@ main() IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-weather-colors" "orange dark_gray") script="#(cat $datafile)" - fi - if [ $plugin = "time" ]; then + elif [ $plugin = "time" ]; then IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-time-colors" "dark_purple white") if $show_day_month && $show_military ; then # military time and dd/mm script="%a %d/%m %R ${timezone} " @@ -201,6 +190,9 @@ main() else script="%a %m/%d %I:%M %p ${timezone} " fi + + else + continue fi if $show_powerline; then