update_plugin.sh: make script faster and fix syntax
This commit is contained in:
parent
5de37f98bb
commit
43e09f4f43
1 changed files with 21 additions and 13 deletions
|
@ -8,7 +8,7 @@ HELPERS_DIR="$CURRENT_DIR/helpers"
|
||||||
source "$HELPERS_DIR/plugin_functions.sh"
|
source "$HELPERS_DIR/plugin_functions.sh"
|
||||||
source "$HELPERS_DIR/utility.sh"
|
source "$HELPERS_DIR/utility.sh"
|
||||||
|
|
||||||
if [ "$1" == "--tmux-echo" ]; then # tmux-specific echo functions
|
if [[ "$1" == "--tmux-echo" ]]; then # tmux-specific echo functions
|
||||||
source "$HELPERS_DIR/tmux_echo_functions.sh"
|
source "$HELPERS_DIR/tmux_echo_functions.sh"
|
||||||
else # shell output functions
|
else # shell output functions
|
||||||
source "$HELPERS_DIR/shell_echo_functions.sh"
|
source "$HELPERS_DIR/shell_echo_functions.sh"
|
||||||
|
@ -38,28 +38,36 @@ update_all() {
|
||||||
echo_ok ""
|
echo_ok ""
|
||||||
local plugins="$(tpm_plugins_list_helper)"
|
local plugins="$(tpm_plugins_list_helper)"
|
||||||
for plugin in $plugins; do
|
for plugin in $plugins; do
|
||||||
local plugin_name="$(plugin_name_helper "$plugin")"
|
run_parallel_all() {
|
||||||
# updating only installed plugins
|
local plugin_name="$(plugin_name_helper "$plugin")"
|
||||||
if plugin_already_installed "$plugin_name"; then
|
# updating only installed plugins
|
||||||
update "$plugin_name"
|
if plugin_already_installed "$plugin_name"; then
|
||||||
fi
|
update "$plugin_name"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
run_parallel_all &
|
||||||
done
|
done
|
||||||
|
wait
|
||||||
}
|
}
|
||||||
|
|
||||||
update_plugins() {
|
update_plugins() {
|
||||||
local plugins="$*"
|
local plugins="$*"
|
||||||
for plugin in $plugins; do
|
for plugin in $plugins; do
|
||||||
local plugin_name="$(plugin_name_helper "$plugin")"
|
run_parallel() {
|
||||||
if plugin_already_installed "$plugin_name"; then
|
local plugin_name="$(plugin_name_helper "$plugin")"
|
||||||
update "$plugin_name"
|
if plugin_already_installed "$plugin_name"; then
|
||||||
else
|
update "$plugin_name"
|
||||||
echo_err "$plugin_name not installed!"
|
else
|
||||||
fi
|
echo_err "$plugin_name not installed!"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
run_parallel &
|
||||||
done
|
done
|
||||||
|
wait
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
if [ "$1" == "all" ]; then
|
if [[ "$1" == "all" ]]; then
|
||||||
update_all
|
update_all
|
||||||
else
|
else
|
||||||
update_plugins "$*"
|
update_plugins "$*"
|
||||||
|
|
Loading…
Reference in a new issue