v1.0.0
===================================================================== Finally decided to port personal scripts into a standalone library. --- Release Notes ------------------------ - added support for python, zsh, and zx scripts - added support for "interactive" scripts which drop the user to a REPL - added support for passing arguments to commands - added support for python/node virtualenv management through scwrypts - added contributing and usage docs - updated zsh plugin to write commands to history - licensed under GPLv3 --- New Scripts -------------------------- zsh/scwrypts ) - configure - environment/copy - environment/delete - environment/edit - environment/synchronize - logs/clear - logs/view zsh ) - aws/ecr/login - aws/efs/mount - aws/efs/unmount - aws/route53/backup - aws/s3/media-sync/pull - aws/s3/media-sync/push python ) - redis/interactive
This commit is contained in:
24
zsh/scwrypts/environment/copy
Executable file
24
zsh/scwrypts/environment/copy
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/zsh
|
||||
source ${0:a:h}/common.zsh
|
||||
__CHECK_IMPORTS
|
||||
#####################################################################
|
||||
|
||||
__PROMPT 'choose an environment to copy'
|
||||
TEMPLATE_ENV_NAME=$(__SELECT_ENV)
|
||||
[ ! $TEMPLATE_ENV_NAME ] && __ABORT
|
||||
|
||||
__STATUS "selected '$TEMPLATE_ENV_NAME'"
|
||||
|
||||
__PROMPT 'enter new environment name'
|
||||
ENV_NAME=$(__FZF_HEAD 'new environment')
|
||||
[ ! $ENV_NAME ] && __ABORT
|
||||
|
||||
TEMPLATE_ENV_FILE=$(__GET_ENV_FILE $TEMPLATE_ENV_NAME)
|
||||
ENV_FILE=$(__GET_ENV_FILE $ENV_NAME)
|
||||
|
||||
[ -f "$ENV_FILE" ] && __FAIL 2 "'$ENV_NAME' already exists"
|
||||
|
||||
__STATUS "creating environment"
|
||||
cp "$TEMPLATE_ENV_FILE" "$ENV_FILE" \
|
||||
&& __SUCCESS "created '$ENV_NAME'" \
|
||||
|| __FAIL 3 "unable to create '$ENV_NAME'"
|
Reference in New Issue
Block a user