From b1844cd8bb0341ca3b41139271c1a1817589c708 Mon Sep 17 00:00:00 2001 From: Kamontat Chantrachirathumrong Date: Mon, 10 May 2021 11:57:15 +0700 Subject: [PATCH] chore(release): version 5.3.4 --- .zshrc | 1 + CHANGELOG.md | 7 ++++ init.sh | 4 +-- src/app/gcloud.sh | 65 ++++++++++++++----------------------- src/utils/helper/checker.sh | 2 ++ 5 files changed, 37 insertions(+), 42 deletions(-) diff --git a/.zshrc b/.zshrc index 173fa93..c97c301 100644 --- a/.zshrc +++ b/.zshrc @@ -23,6 +23,7 @@ export MYZS_LOADING_PLUGINS=( # "myzs-plugins/macos#master" # "myzs-plugins/thefuck#master" + "myzs-plugins/python#main" # "myzs-plugins/nodejs#master" # "myzs-plugins/docker#master" # "kamontat/mplugin-kamontat#master" diff --git a/CHANGELOG.md b/CHANGELOG.md index 9729cc1..bfa0971 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Release notes +## Version 5.3.4 (10 May 2021) + +- add logging when checking os and shell +- upgrade app/gcloud.sh to support latest version +- add new plugin `myzs-plugins/python` for conda support +- now plugin default branch will be **main** instead of **master** + ## Version 5.3.3 (21 Apr 2021) - add error progress when zplug load failed diff --git a/init.sh b/init.sh index 393b3b0..dbd0183 100644 --- a/init.sh +++ b/init.sh @@ -9,9 +9,9 @@ export __MYZS__COM="${_MYZS_ROOT}/resources/completion" export ZPLUG_HOME="${MYZS_ZPLUG:-${_MYZS_ROOT}/zplug}" export __MYZS__OWNER="Kamontat Chantrachirathumrong" -export __MYZS__VERSION="5.3.3" +export __MYZS__VERSION="5.3.4" export __MYZS__SINCE="21 Apr 2018" -export __MYZS__LAST_UPDATED="21 Apr 2021" +export __MYZS__LAST_UPDATED="10 May 2021" export __MYZS__LICENSE="MIT" export __MYZS__MODULES=() diff --git a/src/app/gcloud.sh b/src/app/gcloud.sh index f0f3037..6d1afbc 100644 --- a/src/app/gcloud.sh +++ b/src/app/gcloud.sh @@ -2,48 +2,33 @@ _myzs:internal:module:initial "$0" -initial() { - local _gcloud_default_name="${1:-google-cloud-sdk}" - - local _gcloud_default1="/opt" # application location - local _gcloud_default2="/usr/local/Cellar" # homebrew location - local _gcloud_default3="/usr/local/bin" # legacy location - - _myzs:internal:checker:folder-exist "$_gcloud_default1/${_gcloud_default_name}" && - export __MYZS__DEFAULT_GCLOUD_LOCATION="$_gcloud_default1/${_gcloud_default_name}" - - _myzs:internal:checker:folder-exist "$_gcloud_default2/${_gcloud_default_name}" && - export __MYZS__DEFAULT_GCLOUD_LOCATION="$_gcloud_default2/${_gcloud_default_name}" - - _myzs:internal:checker:folder-exist "$_gcloud_default3/${_gcloud_default_name}" && - export __MYZS__DEFAULT_GCLOUD_LOCATION="$_gcloud_default3/${_gcloud_default_name}" - - _myzs:internal:checker:folder-exist "${_gcloud_default_name}" && - export __MYZS__DEFAULT_GCLOUD_LOCATION="${_gcloud_default_name}" - - local current_path="${__MYZS__DEFAULT_GCLOUD_LOCATION}" - _myzs:internal:checker:command-exist "gcloud" && - current_path="$(dirname "$(dirname "$(which gcloud)")")" - - local gcloud_path="${current_path:-$default_path}" - - _myzs:internal:path-push "${gcloud_path}/bin" - # The next line enables shell command completion for gcloud. - _myzs:internal:load "Google Cloud SDK path" "${gcloud_path}/completion.$(_myzs:internal:shell).inc" +_myzs:private:gcloud:initial() { + local _local_shell _gcloud_fullpath + _local_shell="$(_myzs:internal:shell)" + local _path_filename="path.$_local_shell.inc" + local _completion_filename="completion.$_local_shell.inc" + local _gcloud_default_name="google-cloud-sdk" + local _gcloud_paths=( + "/opt" + "/usr/local/Cellar" + "/usr/local/bin" + "/usr/local/etc" + ) + + export __MYZS__DEFAULT_GCLOUD_DIRPATH="" + for _gcloud_path in "${_gcloud_paths[@]}"; do + _gcloud_fullpath="$_gcloud_path/$_gcloud_default_name" + if _myzs:internal:checker:folder-exist "$_gcloud_fullpath"; then + __MYZS__DEFAULT_GCLOUD_DIRPATH="$_gcloud_fullpath" + fi + done - if ! _myzs:internal:checker:command-exist "gcloud"; then - if _myzs:internal:checker:string-exist "$__MYZS__DEFAULT_GCLOUD_LOCATION"; then - _myzs:internal:log:info "loading gcloud from ${__MYZS__DEFAULT_GCLOUD_LOCATION}" + if _myzs:internal:checker:string-exist "$__MYZS__DEFAULT_GCLOUD_DIRPATH"; then + _myzs:internal:log:debug "loading gcloud from ${__MYZS__DEFAULT_GCLOUD_DIRPATH}" - local install_path="${__MYZS__DEFAULT_GCLOUD_LOCATION}/install.sh" - $install_path - else - _myzs:internal:log:info "cannot found gcloud-sdk location, create \$MYZS_GCLOUD_LOCATION and point to gcloud-sdk location path" - _myzs:internal:failed 2 - fi - else - _myzs:internal:log:info "command gcloud already existed, skip initial" + _myzs:internal:load "Google Cloud SDK path" "$__MYZS__DEFAULT_GCLOUD_DIRPATH/$_path_filename" + _myzs:internal:load "Google Cloud SDK completion" "$__MYZS__DEFAULT_GCLOUD_DIRPATH/$_completion_filename" fi } -initial "$MYZS_GCLOUD_LOCATION" +_myzs:private:gcloud:initial diff --git a/src/utils/helper/checker.sh b/src/utils/helper/checker.sh index cc6dcb1..8185376 100644 --- a/src/utils/helper/checker.sh +++ b/src/utils/helper/checker.sh @@ -6,6 +6,7 @@ fi _myzs:private:checker:shell() { if grep -q "$1" <<<"$SHELL"; then + _myzs:internal:log:debug "You loading on $SHELL" return 0 else return 1 @@ -87,6 +88,7 @@ _myzs:internal:checker:mac() { local name name="$(uname -s)" if [[ "$name" = "Darwin" ]]; then + _myzs:internal:log:debug "You loading on MacOS" return 0 else return 1