Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colourise update response to make failure more apparent #254

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion bindings/update_plugins
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
# - shows a list of installed plugins
# - starts a prompt to enter the name of the plugin that will be updated

if command -v tput >/dev/null; then
yellow=$(tput setaf 3)
norm=$(tput sgr0)
fi

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SCRIPTS_DIR="$CURRENT_DIR/../scripts"
HELPERS_DIR="$SCRIPTS_DIR/helpers"
Expand All @@ -24,7 +29,7 @@ display_plugin_update_list() {
# displaying only installed plugins
if plugin_already_installed "$plugin"; then
local plugin_name="$(plugin_name_helper "$plugin")"
tmux_echo " $plugin_name"
tmux_echo " ${yellow}${plugin_name}${norm}"
fi
done

Expand Down
11 changes: 9 additions & 2 deletions scripts/update_plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

# this script handles core logic of updating plugins

if command -v tput >/dev/null; then
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
norm=$(tput sgr0)
fi

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
HELPERS_DIR="$CURRENT_DIR/helpers"

Expand Down Expand Up @@ -29,10 +36,10 @@ update() {
local plugin="$1" output
output=$(pull_changes "$plugin" 2>&1)
if (( $? == 0 )); then
echo_ok " \"$plugin\" update success"
echo_ok " \"${yellow}${plugin}${norm}\" ${green}update success${norm}"
echo_ok "$(echo "$output" | sed -e 's/^/ | /')"
else
echo_err " \"$plugin\" update fail"
echo_err " \"${yellow}${plugin}${norm}\" ${red}update fail${norm}"
echo_err "$(echo "$output" | sed -e 's/^/ | /')"
fi
}
Expand Down