diff --git a/cmds/cmds-git.zsh b/cmds/cmds-git.zsh index da79b65f..124d3363 100644 --- a/cmds/cmds-git.zsh +++ b/cmds/cmds-git.zsh @@ -195,4 +195,10 @@ function gpa { _loading "Applying patch $1" git apply $1 +} + +# -- gl - Git log +help_git[gl]="Git log" +function gl { + git log } \ No newline at end of file diff --git a/cmds/cmds-proxmox.zsh b/cmds/cmds-proxmox.zsh index 9bc8a0a9..ad2b6d3d 100644 --- a/cmds/cmds-proxmox.zsh +++ b/cmds/cmds-proxmox.zsh @@ -364,8 +364,7 @@ function _proxmox_createtemp () { # -- proxmox_info _proxmox_info () { _debug_all - _debug_all - _banner_green "Proxmox instance infornation" + _loading "Proxmox instance infornation" echo "----------------------------" echo "Version: $(pveversion)" echo "Storage: $(pvesm status -content images | awk {'if (NR!=1) print $1 '})" diff --git a/cmds/cmds-software.zsh b/cmds/cmds-software.zsh index 78d0c8d2..ff9d6422 100644 --- a/cmds/cmds-software.zsh +++ b/cmds/cmds-software.zsh @@ -146,11 +146,11 @@ gp-apt () { # -- php-install help_software[php-install]="One liner for PHP package install" php-install () { - _banner_green "For Remi on CentOS" + _loading "For Remi on CentOS" echo "yum install php74-{php-recode,php-snmp,php-pecl-apcu,php-ldap,php-pecl-memcached,php-imap,php-odbc,php-xmlrpc,php-intl,php-process,php-pecl-igbinary,php-pear,php-pecl-imagick,php-tidy,php-pspell,php-pdo,php-pecl-mcrypt,php-soap,php-mbstring,php-mysqli}" - _banner_green "For Ubuntu" + _loading "For Ubuntu" echo "apt-get install php74-{mbstring,mysql}" - _banner_green "For Ubuntu and Litespeed" + _loading "For Ubuntu and Litespeed" echo "apt-get install lsphp81-{recode,snmp,pecl-apcu,ldap,pecl-memcached,imap,odbc,xmlrpc,intl,process,pecl-igbinary,pear,pecl-imagick,tidy,pspell,pdo,pecl-mcrypt,soap,mbstring,mysqli}" } diff --git a/cmds/cmds-system.zsh b/cmds/cmds-system.zsh index 9484cbde..3fe3a3f9 100644 --- a/cmds/cmds-system.zsh +++ b/cmds/cmds-system.zsh @@ -32,13 +32,13 @@ alias disk="lsblk" # -- sysinfo help_system[sysinfo]='Get system information' sysinfo () { - _banner_green "CPU" + _loading "CPU" cpu - _banner_green "Memory" + _loading "Memory" mem - _banner_green "Disk" + _loading "Disk" disk - _banner_green "Short Format" + _loading "Short Format" } # -- sysinfo diff --git a/lib/functions-core.zsh b/lib/functions-core.zsh index 88e40642..25dce499 100644 --- a/lib/functions-core.zsh +++ b/lib/functions-core.zsh @@ -28,7 +28,7 @@ _loading3 () { echo " - $fg[bright-grey]${@}${RSC}" | tee >(sed 's/^/[LOAD] /' > _loading4 () { echo " -- $fg[bright-grey]${@}${RSC}" | tee >(sed 's/^/[LOAD] /' >> ${SCRIPT_LOG}) } alias _loading_grey=_loading2 -COLOR_FUNCTIONS=(_error _warning _success _noticebg _noticefg _banner_red _banner_green _banner_grey _loading _loading2 _loading3 _loading4) +COLOR_FUNCTIONS=(_error _warning _success _noticebg _noticefg _banner_red _banner_green _banner_grey _loading _loading2 _loading3 _loading4) # -- Text Colors _grey () { echo "$bg[bright-gray]$fg[black] $@ ${RSC}" } diff --git a/lib/functions.zsh b/lib/functions.zsh index 7ff93e50..12117af9 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -30,9 +30,9 @@ alias omz-plugins='escho "OMZ Plugins $OMZ_PLUGINS"' # -- # -- clear cache for various tools # ------------------------------------- -help_zshbop[cc]='Clear cache for antigen + more' -alias cc="zshbop_cacheclear" -zshbop_cacheclear () { +help_zshbop[cache-clear]='Clear cache for antigen + more' +alias cc="zshbop_cache-clear" +zshbop_cache-clear () { _log "${funcstack[1]}:start" _loading "**** Start ZSH cache clear ****" _loading2 "Clearing plugin manager cache" @@ -53,10 +53,10 @@ zshbop_cacheclear () { echo "" } -# -- zshbop_scc -alias scc="zshbop_scc" -help_zshbop[zshbop_scc]='Clear everything, including zsh autocompletion' -zshbop_scc () { +# -- cache-clear-super +alias scc="cache-clear-super" +help_zshbop[cache-clear-super]='Clear everything, including zsh autocompletion' +zshbop_cache-clear-super () { _loading "Clearing rm ~/.zcompdump*" rm -f ~/.zcompdump* } @@ -72,32 +72,21 @@ zshbop_reload () { if [[ $1 == "-q" ]]; then _loading "Quick reload of zshbop" export RUN_REPORT=0 - zshbop_cacheclear + zshbop_cache-clear source $ZBR/lib/*.zsh source $ZBR/cmds/*.zsh _loading "Load zshbop custom config" - zshbop_load_custom + zshbop_custom-load else _loading "Reloading zshbop" export RUN_REPORT=1 export ZSHBOP_RELOAD=1 - zshbop_cacheclear + zshbop_cache-clear _log "Running exec zsh" exec zsh fi } -# --------------------- -# -- zshbop_startup () -# -- -# -- Run zshbop startup -# --------------------- -help_zshbop[startup]='Run zshbop startup' -zshbop_startup () { - _debug_all - init_motd -} - # -------------------------- # -- zshbop_branch ($branch) # -- @@ -107,11 +96,17 @@ help_zshbop[branch]='Run main or dev branch of zshbop' zshbop_branch () { _debug_all if [[ -n $2 ]]; then - echo " -- Switching to $2 branch" + _loading " -- Switching to $2 branch" GIT_CHECKOUT=$(git --git-dir=$ZSHBOP_ROOT/.git --work-tree=$ZSHBOP_ROOT checkout $2) - if [[ $? -ge "1" ]]; then - _error "Branch doesn't seem to exist" - fi + _debug "GIT_CHECKOUT: $GIT_CHECKOUT" + if [[ $? -eq "0" ]]; then + _success " -- Switched to $2 branch, pulling latest changes" + git pull + else + _error " -- Failed to switch to $2 branch" + fi + elif [[ $? -ge "1" ]]; then + _error "Branch doesn't seem to exist" elif [ -z $2 ]; then echo " -- zshbop: $ZSHBOP_ROOT branch: $ZSHBOP_BRANCH ----" echo " -- To switch branch type 'zshbop branch dev' or 'zshbop branch main'" @@ -195,11 +190,6 @@ zshbop_update () { git --git-dir=$ZSHBOP_ROOT/.git --work-tree=$ZSHBOP_ROOT pull fi - # Check if .zshrc is out of date - Called from script directly versus cached functions - _loading2 "Previous version check" - source $ZBR/lib/functions.zsh - zshbop_previous-version-check - # Update repos repos update @@ -235,36 +225,13 @@ zshbop_update () { _banner_yellow "**** END UPDATING ZSHBOP ****" echo "" } -# ----------------------------------- -# -- zshbop_pervious-version-check () -# ----------------------------------- -help_zshbop[previous-version-check]='Checking if \$HOME/.zshrc is pre v1.1.3 and replacing.' -zshbop_previous-version-check () { - _debug_all - - # Replacing .zshrc previous to v1.1.2 256bb9511533e9697f639821ba63adb9 - _debug " -- Current $HOME/.zshrc md5 is - $ZSHBOP_HOME_MD5" - _debug " -- zshbop .zshrc md5 is - $ZSHBOP_LATEST_MD5" - if [[ "$ZSHBOP_HOME_MD5" != "$ZSHBOP_LATEST_MD5" ]]; then - _error "-- Found old .zshrc" - _notice "-- Replacing $HOME/.zshrc" - cp $ZSHBOP_ROOT/.zshrc $HOME/.zshrc - else - _debug " -- No need to fix .zshrc" - fi -} # -------------------- # -- zshbop_version () # -------------------- help_zshbop[version]='Get version information' zshbop_version () { - echo "zshbop Version: ${fg[green]}${ZSHBOP_VERSION}/${fg[black]}${bg[cyan]}${ZSHBOP_BRANCH}${reset_color}" -} - -help_zshbop[commit]='Get commit information' -zshbop_commit () { - echo "zshbop Commit: ${fg[black]}${bg[cyan]}${ZSHBOP_BRANCH}${reset_color}${fg[green]}/$ZSHBOP_COMMIT${RSC}" + echo "zshbop Version: ${fg[green]}${ZSHBOP_VERSION}/${fg[black]}${bg[cyan]}${ZSHBOP_BRANCH}${reset_color}/$ZSHBOP_COMMIT${RSC}" } # ------------------ @@ -339,26 +306,25 @@ zshbop_colors () { # ---------------- help_zshbop[custom]='Custom zshbop configuration' zshbop_custom () { - _banner_green "Instructions on how to utilize custom zshbop configuration." + _loading "Instructions on how to utilize custom zshbop configuration." echo " - Create a file called .zshbop.custom in your /$HOME directory" - echo " - Done!" echo " - You can also copy the .zshbop.custom file within this repository as a template" } # --------------------- -# -- zshbop_load_custom +# -- zshbop_custom-load # --------------------- -help_zshbop[load_custom]='Load zshbop custom config' -zshbop_load_custom () { +help_zshbop[custom-load]='Load zshbop custom config' +zshbop_custom-load () { if [[ $1 == "-q" ]]; then [[ -f $HOME/.zshbop.conf ]] && source $HOME/.zshbop.conf else # -- Check for $HOME/.zshbop.config, load last to allow overwritten core functions _log "Checking for $HOME/.zshbop.conf" if [[ -f $HOME/.zshbop.conf ]]; then - ZSHBOP_CUSTOM="$HOME/.zshbop.conf" - _loading3 "Loaded custom zshbop config at $ZSHBOP_CUSTOM" - source $ZSHBOP_CUSTOM + ZSHBOP_CUSTOM_CFG="$HOME/.zshbop.conf" + _loading3 "Loaded custom zshbop config at $ZSHBOP_CUSTOM_CFG" + source $ZSHBOP_CUSTOM_CFG else _warning "No custom zshbop config found. Type zshbop custom for more information" fi @@ -437,8 +403,8 @@ zshbop_report () { # ============================================== # -- system_check - check usualy system stuff # ============================================== -help_zshbop[systemcheck]='Print out errors and warnings' -zshbop_systemcheck () { +help_zshbop[check-system]='Print out errors and warnings' +zshbop_check-system () { # -- start _debug_all diff --git a/lib/init.zsh b/lib/init.zsh index 7157ff95..e5324175 100644 --- a/lib/init.zsh +++ b/lib/init.zsh @@ -531,7 +531,7 @@ init_motd () { echo "" _loading "System check on $MACHINE_OS" - zshbop_systemcheck + zshbop_check-system init_check_vm echo "" @@ -584,7 +584,7 @@ function init_zshbop () { init-app-config # -- Common application configuration init_omz_plugins # -- Init OhMyZSH plugins init_p10k # -- Init powerlevel10k - zshbop_load_custom # -- Init custom zshbop + zshbop_custom-load # -- Init custom zshbop init_os # -- Init os defaults # TODO Needs to be refactored init_app_config # -- Init config init_zsh_sweep # -- Init zsh-sweep if installed diff --git a/version b/version index 642c63c4..0409c163 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.8.3 \ No newline at end of file +2.8.4 \ No newline at end of file diff --git a/zshbop.zsh b/zshbop.zsh index 60d17726..569b6f12 100755 --- a/zshbop.zsh +++ b/zshbop.zsh @@ -10,6 +10,8 @@ # -- Potential zshbop paths, including old zsh path, left over from .zshrc removal ZSHBOP_PATHS=("$HOME/zshbop" "$HOME/zsh" "$HOME/git/zshbop" "$HOME/git/zsh" "/usr/local/sbin/zshbop" "/usr/local/sbin/zsh") +export ZSHBOP_ROOT=${0:a:h} +export ZSHBOP_VERSION=$(cat ${ZSHBOP_ROOT}/version) # -- Current version installed # --------------------------- # ---- Variables @@ -50,7 +52,6 @@ export ZSHBOP_NAME="zshbop" # -- Current zshbop branch export SCRIPT_DIR=${0:a:h} # -- Current working directory export ZSHBOP_CACHE_DIR="${HOME}/.zshbop_cache" export ZSHBOP_PLUGIN_MANAGER="init_antidote" -export ZSHBOP_VERSION=$(<$ZSHBOP_ROOT/version) # -- Current version installed export ZSH_ROOT="${ZSHBOP_ROOT}" # -- Converting from ZSH_ROOT to ZSHBOP_ROOT export ZBR="${ZSHBOP_ROOT}" # -- Short hand $ZSHBOP_ROOT export KB="${ZSHBOP_ROOT}/kb" @@ -181,11 +182,6 @@ source ${ZSHBOP_ROOT}/lib/kb.zsh # -- Built in Knolwedge Base ############################################################ -# -- zshbop.config -if [[ -f $HOME/.zshbop.config ]]; then - source $HOME/.zshbop.config -fi - # -- Check for old bits zshbop_cleanup