Compare commits

..

1 Commits

Author SHA1 Message Date
3fe01a7263 v4.4.0
=====================================================================

Increased non-scwrypts-runtime compatibility and improved clarity
in user environments after sourcing the scwrypts.plugin.zsh.

--- New Features -------------------------

- added experimental support for --output json
- added 'scwrypts --list-groups' to output the SCWRYPTS_GROUPS value
- added 'scwrypts --config' to be `eval`-ed in non-scwrypts-runtime zsh

--- Changes ------------------------------

- removed config variables which pertained to old scwrypts

- removed deprecated --no-log

- cleaned up environment requirements and improved import saftey for
  scwrypts.plugin.zsh; scwrypts is now *required* on $PATH in order to work

- refactored group configuration to match external group configuration
  (configuration now in scwrypts.scwrypts.zsh rather than zsh/lib/config.group.zsh)

- plugins/kubectl now forces an unalias of `f` (for fluxcd) on load

- the 'use' command now supports the '-c' short flag for ease of quick
  use

- upgraded max supported python version to 3.12; dropped support for
  python 3.9 (>3.10 required)

- remove old references to SCWRYPTS_ROOT in favour of SCWRYPTS_ROOT__scwrypts

- SCWRYPTS_LOG_LEVEL setting is now forwarded when using the SCWRYPTS__RUN
  meta execution function
2024-05-08 23:11:09 -06:00
5 changed files with 67 additions and 47 deletions

View File

@ -1,3 +1,12 @@
#
# typically you do not need to reload this plugin in a single session;
# if for some reason you do, you can run the following command and
# source this file again
#
# unset __SCWRYPTS_PLUGIN_LOADED
#
[[ $__SCWRYPTS_PLUGIN_LOADED =~ true ]] && return 0
##################################################################### #####################################################################
: \ : \
@ -22,21 +31,24 @@ __SCWRYPTS_PARSE() {
##################################################################### #####################################################################
SCWRYPTS__ZSH_PLUGIN() { [ $SCWRYPTS_SHORTCUT ] && {
SCWRYPTS__ZSH_PLUGIN() {
local SCWRYPT_SELECTION NAME TYPE GROUP local SCWRYPT_SELECTION NAME TYPE GROUP
__SCWRYPTS_PARSE || { zle accept-line; return 0; } __SCWRYPTS_PARSE || { zle accept-line; return 0; }
RBUFFER="scwrypts --name $NAME --type $TYPE --group $GROUP" RBUFFER="scwrypts --name $NAME --type $TYPE --group $GROUP"
zle accept-line zle accept-line
} }
zle -N scwrypts SCWRYPTS__ZSH_PLUGIN zle -N scwrypts SCWRYPTS__ZSH_PLUGIN
bindkey $SCWRYPTS_SHORTCUT scwrypts bindkey $SCWRYPTS_SHORTCUT scwrypts
unset SCWRYPTS_SHORTCUT unset SCWRYPTS_SHORTCUT
}
##################################################################### #####################################################################
SCWRYPTS__ZSH_BUILDER_PLUGIN() { [ $SCWRYPTS_BUILDER_SHORTCUT ] && {
SCWRYPTS__ZSH_BUILDER_PLUGIN() {
local SCWRYPT_SELECTION NAME TYPE GROUP local SCWRYPT_SELECTION NAME TYPE GROUP
__SCWRYPTS_PARSE || { echo >&2; zle accept-line; return 0; } __SCWRYPTS_PARSE || { echo >&2; zle accept-line; return 0; }
echo $SCWRYPT_SELECTION >&2 echo $SCWRYPT_SELECTION >&2
@ -49,15 +61,17 @@ SCWRYPTS__ZSH_BUILDER_PLUGIN() {
zle reset-prompt zle reset-prompt
LBUFFER="scwrypts --name $NAME --type $TYPE --group $GROUP -- " LBUFFER="scwrypts --name $NAME --type $TYPE --group $GROUP -- "
} }
zle -N scwrypts-builder SCWRYPTS__ZSH_BUILDER_PLUGIN zle -N scwrypts-builder SCWRYPTS__ZSH_BUILDER_PLUGIN
bindkey $SCWRYPTS_BUILDER_SHORTCUT scwrypts-builder bindkey $SCWRYPTS_BUILDER_SHORTCUT scwrypts-builder
unset SCWRYPTS_BUILDER_SHORTCUT unset SCWRYPTS_BUILDER_SHORTCUT
}
##################################################################### #####################################################################
SCWRYPTS__ZSH_PLUGIN_ENV() { [ $SCWRYPTS_ENV_SHORTCUT ] && {
SCWRYPTS__ZSH_PLUGIN_ENV() {
local RESET='reset' local RESET='reset'
local SELECTED=$(\ local SELECTED=$(\
{ [ $SCWRYPTS_ENV ] && echo $RESET; scwrypts --list-envs; } \ { [ $SCWRYPTS_ENV ] && echo $RESET; scwrypts --list-envs; } \
@ -71,10 +85,13 @@ SCWRYPTS__ZSH_PLUGIN_ENV() {
|| RBUFFER="export SCWRYPTS_ENV=$SELECTED" || RBUFFER="export SCWRYPTS_ENV=$SELECTED"
} }
zle accept-line zle accept-line
}
zle -N scwrypts-setenv SCWRYPTS__ZSH_PLUGIN_ENV
bindkey $SCWRYPTS_ENV_SHORTCUT scwrypts-setenv
unset SCWRYPTS_ENV_SHORTCUT
} }
zle -N scwrypts-setenv SCWRYPTS__ZSH_PLUGIN_ENV
bindkey $SCWRYPTS_ENV_SHORTCUT scwrypts-setenv
unset SCWRYPTS_ENV_SHORTCUT
##################################################################### #####################################################################
__SCWRYPTS_PLUGIN_LOADED=true

View File

@ -25,7 +25,7 @@ export SCWRYPTS_ROOT__scwrypts="$SCWRYPTS_ROOT"
##################################################################### #####################################################################
DEFAULT_CONFIG="$SCWRYPTS_ROOT/zsh/lib/config.user.zsh" DEFAULT_CONFIG="$SCWRYPTS_ROOT__scwrypts/zsh/lib/config.user.zsh"
source "$DEFAULT_CONFIG" source "$DEFAULT_CONFIG"
USER_CONFIG_OVERRIDES="$SCWRYPTS_CONFIG_PATH/config.zsh" USER_CONFIG_OVERRIDES="$SCWRYPTS_CONFIG_PATH/config.zsh"

View File

@ -12,7 +12,10 @@ SCWRYPTS__RUN() { # context wrapper to run scwrypts within scwrypts
local EXIT_CODE=0 local EXIT_CODE=0
((SUBSCWRYPT+=1)) ((SUBSCWRYPT+=1))
SUBSCWRYPT=$SUBSCWRYPT $SCWRYPTS_ROOT/scwrypts $@ SCWRYPTS_LOG_LEVEL=$SCWRYPTS_LOG_LEVEL \
SUBSCWRYPT=$SUBSCWRYPT \
$SCWRYPTS_ROOT__scwrypts/scwrypts $@
EXIT_CODE=$? EXIT_CODE=$?
((SUBSCWRYPT-=1)) ((SUBSCWRYPT-=1))

View File

@ -94,7 +94,7 @@ SCWRYPTS__GET_RUNSTRING() {
} }
RUNSTRING="SCWRYPTS_ENV=$ENV_NAME; $RUNSTRING" RUNSTRING="SCWRYPTS_ENV=$ENV_NAME; $RUNSTRING"
RUNSTRING="source $SCWRYPTS_ROOT/zsh/lib/import.driver.zsh; $RUNSTRING" RUNSTRING="source $SCWRYPTS_ROOT__scwrypts/zsh/lib/import.driver.zsh; $RUNSTRING"
local _VIRTUALENV=$(eval echo '$SCWRYPTS_VIRTUALENV_PATH__'$SCWRYPT_GROUP'/$SCWRYPT_TYPE/bin/activate') local _VIRTUALENV=$(eval echo '$SCWRYPTS_VIRTUALENV_PATH__'$SCWRYPT_GROUP'/$SCWRYPT_TYPE/bin/activate')
[ -f $_VIRTUALENV ] && RUNSTRING="source $_VIRTUALENV; $RUNSTRING" [ -f $_VIRTUALENV ] && RUNSTRING="source $_VIRTUALENV; $RUNSTRING"

View File

@ -124,7 +124,7 @@ UPDATE_VIRTUALENV__scwrypts__py() {
PIP_INSTALL_ARGS+=(--no-cache-dir) PIP_INSTALL_ARGS+=(--no-cache-dir)
PIP_INSTALL_ARGS+=(-r requirements.txt) PIP_INSTALL_ARGS+=(-r requirements.txt)
cd "$SCWRYPTS_ROOT/py" cd "$SCWRYPTS_ROOT__scwrypts/py"
pip install ${PIP_INSTALL_ARGS[@]} pip install ${PIP_INSTALL_ARGS[@]}
} }
@ -161,7 +161,7 @@ ACTIVATE_VIRTUALENV__scwrypts__zx() {
UPDATE_VIRTUALENV__scwrypts__zx() { UPDATE_VIRTUALENV__scwrypts__zx() {
local NPM_INSTALL_ARGS=() local NPM_INSTALL_ARGS=()
cd "$SCWRYPTS_ROOT/zx" cd "$SCWRYPTS_ROOT__scwrypts/zx"
npm install ${NPM_INSTALL_ARGS[@]} npm install ${NPM_INSTALL_ARGS[@]}
} }