File tree Expand file tree Collapse file tree 4 files changed +25
-4
lines changed
Expand file tree Collapse file tree 4 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,18 @@ _zush_do_tool_initialization() {
8585zush_lazy_load () {
8686 local tool=$1
8787 local init_command=$2
88+
89+ # Validate required parameters
90+ if [[ -z " $tool " ]]; then
91+ zush_error " zush_lazy_load: tool name is required (got: '$tool ')"
92+ return 1
93+ fi
94+
95+ if [[ -z " $init_command " ]]; then
96+ zush_error " zush_lazy_load: init command is required (got: '$init_command ')"
97+ return 1
98+ fi
99+
88100 shift 2
89101 local -a commands=(" $@ " )
90102
Original file line number Diff line number Diff line change @@ -76,8 +76,17 @@ _zushp_add_to_manifest() {
7676# Main plugin function
7777zushp () {
7878 local user_repo=" $1 "
79-
80- [[ -z " $user_repo " ]] && { echo " Usage: zushp <user/repo>" ; return 1; }
79+
80+ # Validate user/repo format
81+ if [[ -z " $user_repo " ]]; then
82+ zush_error " Usage: zushp <user/repo> (got: '$user_repo ')"
83+ return 1
84+ fi
85+
86+ if [[ ! " $user_repo " =~ ^[a-zA-Z0-9_-]+/[a-zA-Z0-9_.-]+$ ]]; then
87+ zush_error " Invalid format. Use: zushp <user/repo> (got: '$user_repo ')"
88+ return 1
89+ fi
8190
8291 local plugin_name=" ${user_repo##*/ } "
8392 local plugin_dir=" ${ZUSH_PLUGINS_DIR} /${plugin_name} "
Original file line number Diff line number Diff line change 22# Sets up editor preferences based on environment
33
44# Use VS Code if local (with -w to wait), vim if remote
5- if [[ -z " $SSH_CONNECTION " ]] && command -v code > /dev/null 2>&1 ; then
5+ if [[ -z " $SSH_CONNECTION " ]] && (( ${+commands[ code]} )) ; then
66 export EDITOR=" code -w"
77 export VISUAL=" code -w"
88else
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ _gwt_message() {
107107}
108108
109109_gwt_require_git () {
110- if ! command -v git > /dev/null 2>&1 ; then
110+ if ! (( ${+commands[ git]} )) ; then
111111 _gwt_error " git is not available"
112112 return 1
113113 fi
You can’t perform that action at this time.
0 commit comments