Now outputs git pull status when updating plugins.
Removed pipe to /dev/null for $(pull_changes $plugin). Part of #76. At least for now, I've formatted the output to look like the below paste. This shows a failed, no-op success, and pull success: =================================================== Updating all plugins! Updating "tpm" | There is no tracking information for the current branch. | Please specify which branch you want to merge with. | See git-pull(1) for details. | | git pull <remote> <branch> | | If you wish to set tracking information for this branch you can do so with: | | git branch --set-upstream-to=<remote>/<branch> nhdaly_update_output "tpm" update fail Updating "tmux-sensible" | Already up-to-date. "tmux-sensible" update success Updating "tmux-scroll-copy-mode" | Updating 1ee5602..5e4c864 | Fast-forward | README.md | 5 +++-- | scroll_copy_mode.tmux | 8 +++++--- | 2 files changed, 8 insertions(+), 5 deletions(-) "tmux-scroll-copy-mode" update success
This commit is contained in:
parent
b4c89884e0
commit
3a39926b86
1 changed files with 19 additions and 3 deletions
|
@ -25,12 +25,28 @@ pull_changes() {
|
|||
GIT_TERMINAL_PROMPT=0 git submodule update --init --recursive
|
||||
}
|
||||
|
||||
print_update_status() {
|
||||
# Indent and format the output from the update command.
|
||||
local plugin="$1"
|
||||
local update_output=$(echo "$2" | awk '{print " | "$0}')
|
||||
local update_status=$3
|
||||
|
||||
if [ $update_status == "0" ]; then
|
||||
echo_ok "$update_output\n \"$plugin\" update success"
|
||||
echo_ok
|
||||
else
|
||||
echo_err "$update_output\n \"$plugin\" update fail"
|
||||
echo_err
|
||||
fi
|
||||
}
|
||||
|
||||
update() {
|
||||
local plugin="$1"
|
||||
echo_ok "Updating \"$plugin\""
|
||||
$(pull_changes "$plugin" > /dev/null 2>&1) &&
|
||||
echo_ok " \"$plugin\" update success" ||
|
||||
echo_err " \"$plugin\" update fail"
|
||||
# Note, this cannot be a local variable, since that seems to supress the $? from being set.
|
||||
update_output=$(pull_changes "$plugin" 2>&1);
|
||||
local update_status="$?"
|
||||
$(print_update_status "$plugin" "$update_output" "$update_status")
|
||||
}
|
||||
|
||||
update_all() {
|
||||
|
|
Loading…
Reference in a new issue