aboutsummaryrefslogtreecommitdiffstats
path: root/ves-run.sh
diff options
context:
space:
mode:
authorDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2026-06-06 12:27:03 -0400
committerDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2026-06-06 12:27:03 -0400
commit0ecfe53b2d271133fac36de11ecfc0f7e47840f0 (patch)
tree3ee8b5188936e350e15ff851b07a33031d366389 /ves-run.sh
parent04b385284a8559bde3df51bab950784a0fd28cfd (diff)
downloadsh-ves-0ecfe53b2d271133fac36de11ecfc0f7e47840f0.tar.gz
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
Diffstat (limited to 'ves-run.sh')
-rw-r--r--ves-run.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/ves-run.sh b/ves-run.sh
new file mode 100644
index 0000000..57e52a0
--- /dev/null
+++ b/ves-run.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# Run a one-off command inside an sh-ves environment without activating it
+# in the current shell. The activation happens in a subshell, so the parent
+# shell's environment is untouched and no deactivation is needed.
+#
+ves_run() {
+ if [ "$#" -lt 2 ]; then
+ printf "ERROR: Insufficient arguments. usage: ves run <env> <command...>\n" >&2
+ return 2
+ fi
+
+ env_name="$1"
+ shift
+
+ if ! _shves_check_env_name "$env_name"; then
+ return 1
+ fi
+
+ if ! _shves_check_env_exists "$env_name"; then
+ return 1
+ fi
+
+ (
+ SHVES_ENV_NM=""
+ SHVES_SAVED_VARS=""
+ ves_activate "$env_name" > /dev/null || exit 1
+ "$@"
+ )
+}