blob: 57e52a01f69b60bbef4b71d17a971b67519c8a1c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
"$@"
)
}
|