yage
f3e70c61cb
===================================================================== --- Changes ------------------------------ - scwrypts runner has new arguments -q/--quiet allows quiet-mode operation while still logging to logfiles -v/--verbose forces verbose mode --version longform required (-v is now for "verbose" mode) - scwrypts runner now auto-detects certain CLI usage, running in quiet, logged mode if pattern match successfully identifies a single scwrypt (or when using --name); use --verbose to override this behavior - 'k exec' no longer requires double '--' if a '--' comes after - old : k exec -it my-pod-0 -- -- /bin/sh + new : k exec -it my-pod-0 -- /bin/sh + still works : k -- exec -it my-pod-0 -- /bin/sh --- Bug Fixes ---------------------------- - fixed various plugins/kubectl auto-completion settings; arguments after '--' or profile number (e.g. 'k 1 get deployments') will now appropriately autocomplete in the indicated profile - helm template functions now work on related .tpl files as well (renders from chart root) - fixed some goofy UTF-8 icons in zsh/lib/utils/io --- New Features ------------------------- - (experimental) scwrypts zsh plugin for interactive command selection (like CTRL+SPACE), but allows you to build command arguments, providing help dialogue for the selected command --- New Scripts -------------------------- - zsh/misc/tally ) helps keep tally-counts of things; helpful when running long scripts "what iteration am I on"
70 lines
1.9 KiB
Bash
70 lines
1.9 KiB
Bash
NO_EXPORT_CONFIG=1 source "${0:a:h}/zsh/lib/import.driver.zsh" || return 42
|
|
|
|
#####################################################################
|
|
SCWRYPTS__ZSH_PLUGIN() {
|
|
local SCWRYPT_SELECTION=$(SCWRYPTS__GET_AVAILABLE_SCWRYPTS | FZF 'select a script' --header-lines 1)
|
|
local NAME
|
|
local TYPE
|
|
local GROUP
|
|
LBUFFER= RBUFFER=
|
|
[ ! $SCWRYPT_SELECTION ] && { zle accept-line; return 0; }
|
|
|
|
SCWRYPTS__SEPARATE_SCWRYPT_SELECTION $SCWRYPT_SELECTION
|
|
|
|
which scwrypts >/dev/null 2>&1\
|
|
&& RBUFFER="scwrypts" || RBUFFER="$SCWRYPTS_ROOT/scwrypts"
|
|
|
|
RBUFFER+=" --name $NAME --group $GROUP --type $TYPE --verbose"
|
|
zle accept-line
|
|
}
|
|
|
|
zle -N scwrypts SCWRYPTS__ZSH_PLUGIN
|
|
bindkey $SCWRYPTS_SHORTCUT scwrypts
|
|
|
|
#####################################################################
|
|
SCWRYPTS__ZSH_BUILDER_PLUGIN() {
|
|
local SCWRYPT_SELECTION=$(SCWRYPTS__GET_AVAILABLE_SCWRYPTS | FZF 'select a script' --header-lines 1)
|
|
local NAME
|
|
local TYPE
|
|
local GROUP
|
|
LBUFFER= RBUFFER=
|
|
[ ! $SCWRYPT_SELECTION ] && { zle accept-line; return 0; }
|
|
|
|
SCWRYPTS__SEPARATE_SCWRYPT_SELECTION $SCWRYPT_SELECTION
|
|
|
|
scwrypts --name $NAME --group $GROUP --type $TYPE -- --help >&2 || {
|
|
zle accept-line
|
|
return 0
|
|
}
|
|
echo
|
|
|
|
zle reset-prompt
|
|
which scwrypts >/dev/null 2>&1\
|
|
&& LBUFFER="scwrypts" || LBUFFER="$SCWRYPTS_ROOT/scwrypts"
|
|
|
|
LBUFFER+=" --name $NAME --group $GROUP --type $TYPE -- "
|
|
}
|
|
|
|
zle -N scwrypts-builder SCWRYPTS__ZSH_BUILDER_PLUGIN
|
|
bindkey $SCWRYPTS_BUILDER_SHORTCUT scwrypts-builder
|
|
|
|
#####################################################################
|
|
SCWRYPTS__ZSH_PLUGIN_ENV() {
|
|
local RESET='reset'
|
|
local SELECTED=$(\
|
|
{ [ $SCWRYPTS_ENV ] && echo $RESET; SCWRYPTS__GET_ENV_NAMES; } \
|
|
| FZF 'select an environment' \
|
|
)
|
|
|
|
zle clear-command-line
|
|
[ $SELECTED ] && {
|
|
[[ $SELECTED =~ ^$RESET$ ]] \
|
|
&& RBUFFER='unset SCWRYPTS_ENV' \
|
|
|| RBUFFER="export SCWRYPTS_ENV=$SELECTED"
|
|
}
|
|
zle accept-line
|
|
}
|
|
|
|
zle -N scwrypts-setenv SCWRYPTS__ZSH_PLUGIN_ENV
|
|
bindkey $SCWRYPTS_ENV_SHORTCUT scwrypts-setenv
|