diff --git a/plugins.d/00-kymsu.sh b/plugins.d/00-kymsu.sh index d59b011..c1d3e88 100755 --- a/plugins.d/00-kymsu.sh +++ b/plugins.d/00-kymsu.sh @@ -37,9 +37,18 @@ else fi current_timestamp=$(date +"%s") -temps=$(( current_timestamp-last_update)) +temps=$(( current_timestamp-last_update )) -if [ $(( temps-w)) -gt 0 ]; then +echo "$w" +# date +'%d-%m-%Y %H:%M:%S' -d @1658067929 +echo "$last_update" +date +'%d-%m-%Y %H:%M:%S' -d @$last_update +echo "$current_timestamp" +date +'%d-%m-%Y %H:%M:%S' -d @$current_timestamp +echo "$temps" + + +if [ $(( temps-w )) -gt 0 ]; then echo "🦄 KYMSU self update" pushd "$(cat ~/.kymsu/path)" > /dev/null #git pull diff --git a/plugins.d/config.shlib b/plugins.d/config.shlib new file mode 100644 index 0000000..f2a51fc --- /dev/null +++ b/plugins.d/config.shlib @@ -0,0 +1,11 @@ +config_read_file() { + (grep -E "^${2}=" -m 1 "${1}" 2>/dev/null || echo "VAR=__UNDEFINED__") | head -n 1 | cut -d '=' -f 2-; +} + +config_get() { + val="$(config_read_file kymsu.cfg "${1}")"; + if [ "${val}" = "__UNDEFINED__" ]; then + val="$(config_read_file config.cfg.defaults "${1}")"; + fi + printf -- "%s" "${val}"; +} \ No newline at end of file diff --git a/plugins.d/homebrew.sh b/plugins.d/homebrew.sh index 02d46a5..122c0d2 100755 --- a/plugins.d/homebrew.sh +++ b/plugins.d/homebrew.sh @@ -3,6 +3,8 @@ # Homebrew plugin for KYMSU # https://github.com/welcoMattic/kymsu +source config.shlib; # load the config library functions + ############################################################################################### # # Settings: @@ -12,7 +14,10 @@ display_info=true # Casks don't have pinned cask. So add Cask to the do_not_update array for prevent to update. # declare -a do_not_update=("xnconvert" "yate") -declare -a cask_to_not_update=(ff-works) +#declare -a cask_to_not_update=(ff-works) + +pinned_cask="$(config_get pinned_cask)" +declare -a cask_to_not_update=($pinned_cask) # No distract mode (no user interaction)(Casks with 'latest' version number won't be updated) #[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false @@ -34,7 +39,6 @@ latest=false : <<'END_COMMENT' blabla -END_COMMENT italic="\033[3m" underline="\033[4m" @@ -44,6 +48,17 @@ red="\033[1;31m" bold="\033[1m" box="\033[1;41m" reset="\033[0m" +END_COMMENT + +italic="$(config_get italic)" +underline="$(config_get underline)" +ita_under="$(config_get ita_under)" +bgd="$(config_get bgd)" +red="$(config_get red)" +bold="$(config_get bold)" +box="$(config_get box)" +reset="$(config_get reset)" + command -v terminal-notifier >/dev/null 2>&1 || { echo -e "You shoud intall ${bold}terminal-notifier${reset} for notification ${italic}(brew install terminal-notifier)${reset}.\n"; } command -v jq >/dev/null 2>&1 || { echo -e "${bold}kymsu2${reset} require ${bold}jq${reset} but it's not installed.\nRun ${italic}(brew install jq)${reset}\nAborting..." >&2; exit 1; } @@ -311,7 +326,7 @@ if (( ${#cask_to_not_update[@]} )); then echo -e "${underline}List of${reset} ${box} $nbp ${reset} ${underline}'do not update' casks:${reset}" echo -e "${red}${cask_to_not_update[*]}${reset}" - echo -e "To remove an app from this list, you need to edit the ${italic}do_not_update${reset} array." + echo -e "To add/remove an app from this list, you need to edit the ${italic}pinned_cask${reset} variable in kymsu.cfg file." echo "" casks_not_pinned="" diff --git a/plugins.d/kymsu.cfg b/plugins.d/kymsu.cfg new file mode 100644 index 0000000..b92cf92 --- /dev/null +++ b/plugins.d/kymsu.cfg @@ -0,0 +1,14 @@ +# General +italic=\033[3m +underline=\033[4m +ita_under=\033[3;4m +bgd=\033[1;4;31m +red=\033[1;31m +bold=\033[1m +box=\033[1;41m +reset=\033[0m + +last.update=1658067929 + +# Homebrew +pinned_cask=ff-works mole \ No newline at end of file diff --git a/plugins.d/nodejs.sh b/plugins.d/nodejs.sh index dae10bd..ac66222 100755 --- a/plugins.d/nodejs.sh +++ b/plugins.d/nodejs.sh @@ -434,9 +434,15 @@ END_COMMENT # nvm use $new_node echo -e "\n${bold}Reinstall packages from v$old_node...${reset}" + echo "$all_global_pkgs" # nvm reinstall-packages bloque sur thumbsup (better-sql) #nvm reinstall-packages "$old_node" - npm install -g "$all_global_pkgs" + + for i in "$all_global_pkgs" + do + echo "--$i--" + done + #npm install -g "$all_global_pkgs" fi