Skip to content

Commit

Permalink
Merge pull request #176 from aaronkollasch/reject-unknown-plugins
Browse files Browse the repository at this point in the history
Reject unrecognized plugins in config
  • Loading branch information
ethancedwards8 authored Apr 8, 2023
2 parents c431005 + e5ccca8 commit eda8c62
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions scripts/dracula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,61 +132,51 @@ main()
IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-cwd-colors" "dark_gray white")
tmux set-option -g status-right-length 250
script="#($current_dir/cwd.sh)"
fi

if [ $plugin = "git" ]; then
elif [ $plugin = "git" ]; then
IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-git-colors" "green dark_gray")
tmux set-option -g status-right-length 250
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
Expand All @@ -195,9 +185,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} "
Expand All @@ -208,6 +197,9 @@ main()
else
script="%a %m/%d %I:%M %p ${timezone} "
fi

else
continue
fi

if $show_powerline; then
Expand Down

0 comments on commit eda8c62

Please sign in to comment.