| 
									
										
										
										
											2022-06-22 12:17:19 -06:00
										 |  |  | DONT_EXIT=1 source ${0:a:h}/zsh/common.zsh | 
					
						
							| 
									
										
										
										
											2022-04-28 16:09:23 -06:00
										 |  |  | ##################################################################### | 
					
						
							|  |  |  | __SCWRYPTS() { | 
					
						
							|  |  |  | 	local SCRIPT=$(__GET_AVAILABLE_SCRIPTS | __FZF 'select a script') | 
					
						
							|  |  |  | 	zle clear-command-line | 
					
						
							|  |  |  | 	[ ! $SCRIPT ] && { zle accept-line; return 0; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	which scwrypts >/dev/null 2>&1\
 | 
					
						
							|  |  |  | 		&& RBUFFER="scwrypts" || RBUFFER="$SCWRYPTS_ROOT/scwrypts" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	RBUFFER+=" $SCRIPT" | 
					
						
							|  |  |  | 	zle accept-line | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-05-24 10:26:05 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-28 16:09:23 -06:00
										 |  |  | zle -N scwrypts __SCWRYPTS | 
					
						
							|  |  |  | bindkey $SCWRYPTS_SHORTCUT scwrypts | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ##################################################################### | 
					
						
							|  |  |  | __SCWRYPTS_ENV() { | 
					
						
							|  |  |  | 	local RESET='reset' | 
					
						
							|  |  |  | 	local SELECTED=$(\
 | 
					
						
							|  |  |  | 		{ [ $SCWRYPTS_ENV ] && echo $RESET; __GET_ENV_NAMES; } \
 | 
					
						
							|  |  |  | 			| __FZF 'select an environment' \
 | 
					
						
							|  |  |  | 	) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	zle clear-command-line | 
					
						
							|  |  |  | 	[ $SELECTED ] && { | 
					
						
							|  |  |  | 		[[ $SELECTED =~ ^$RESET$ ]] \
 | 
					
						
							|  |  |  | 			&& RBUFFER='unset SCWRYPTS_ENV' \
 | 
					
						
							| 
									
										
										
										
											2022-05-24 10:26:05 -06:00
										 |  |  | 			|| RBUFFER="export SCWRYPTS_ENV=$SELECTED" | 
					
						
							| 
									
										
										
										
											2022-04-28 16:09:23 -06:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	zle accept-line | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-05-24 10:26:05 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-28 16:09:23 -06:00
										 |  |  | zle -N scwrypts-setenv __SCWRYPTS_ENV | 
					
						
							|  |  |  | bindkey $SCWRYPTS_ENV_SHORTCUT scwrypts-setenv |