From 0ecfe53b2d271133fac36de11ecfc0f7e47840f0 Mon Sep 17 00:00:00 2001 From: "Douglas B. Rumbaugh" Date: Sat, 6 Jun 2026 12:27:03 -0400 Subject: Initial version complete I dusted this off after years and had Claude finish it for me. caveat emptor: this is largely (though not entirely) LLM generated as of this commit --- ves-create.sh | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) mode change 100644 => 100755 ves-create.sh (limited to 'ves-create.sh') diff --git a/ves-create.sh b/ves-create.sh old mode 100644 new mode 100755 index b4f6467..11e6f05 --- a/ves-create.sh +++ b/ves-create.sh @@ -1,32 +1,43 @@ #!/bin/sh +# +# Create a new sh-ves environment. With --override, the variables listed +# in SHVES_OVERRIDE_VARS (PATH, LDPATH, etc. by default) are initialized +# to empty strings in the new environment, so activating it truncates them. +# _shves_create_env() { file="$SHVES_ENV_DIR/$1" - printf "name: $1\n" > $file + printf "name: %s\n" "$1" > "$file" - if [ "$2" -eq "1" ]; then + if [ "$2" -eq 1 ]; then for var in $SHVES_OVERRIDE_VARS; do - printf "export_var:%s=\n" "$var" >> $file + printf "export_var:%s=\n" "$var" >> "$file" done fi } ves_create() { + override=0 + case $1 in + --override) + override=1 + shift + ;; + esac + if [ "$#" -lt 1 ]; then - printf "ERROR: No environment name specified.\n" > /dev/stderr + printf "ERROR: No environment name specified.\n" >&2 return 1 fi - override=0 env_name="$1" - test "$#" -eq "2" && override=1 if ! _shves_check_env_name "$env_name"; then - return 1; + return 1 fi if _shves_check_env_exists "$env_name" 1; then - printf "ERROR: Environment [%s] already exists.\n" "$env_name" - return 1; + printf "ERROR: Environment [%s] already exists.\n" "$env_name" >&2 + return 1 fi _shves_create_env "$env_name" "$override" -- cgit v1.2.3