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
|
||||||
|
run_parallel_all() {
|
||||||
local plugin_name="$(plugin_name_helper "$plugin")"
|
local plugin_name="$(plugin_name_helper "$plugin")"
|
||||||
# updating only installed plugins
|
# updating only installed plugins
|
||||||
if plugin_already_installed "$plugin_name"; then
|
if plugin_already_installed "$plugin_name"; then
|
||||||
update "$plugin_name"
|
update "$plugin_name"
|
||||||
fi
|
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
|
||||||
|
run_parallel() {
|
||||||
local plugin_name="$(plugin_name_helper "$plugin")"
|
local plugin_name="$(plugin_name_helper "$plugin")"
|
||||||
if plugin_already_installed "$plugin_name"; then
|
if plugin_already_installed "$plugin_name"; then
|
||||||
update "$plugin_name"
|
update "$plugin_name"
|
||||||
else
|
else
|
||||||
echo_err "$plugin_name not installed!"
|
echo_err "$plugin_name not installed!"
|
||||||
fi
|
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