-
Notifications
You must be signed in to change notification settings - Fork 10
/
activate
64 lines (57 loc) · 2.01 KB
/
activate
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# only run if bash or zsh
[ -n "${BASH_VERSION:-}" ] || return 0
export UENV_CMD='env -u PYTHONPATH -u VIRTUAL_ENV @@impl@@'
export UENV_IMG_CMD='env -u PYTHONPATH -u VIRTUAL_ENV @@image_impl@@'
export UENV_VERSION=@@version@@
export UENV_PREFIX=@@prefix@@
export UENV_WRAPPER_CMD=@@wrapper@@
function uenv {
local _last_exitcode=$?
function uenv_usage {
echo "uenv - for using user environments [version @@version@@]"
echo ""
echo "Usage: uenv [--version] [--help] [--no-color] [--verbose] <command> [<args>]"
echo ""
echo "The following commands are available:"
echo " image query and pull uenv images"
echo " repo query and interact with repositories"
echo " run run a command in an environment"
echo " start start a new shell with an environment loaded"
echo " status print information about each running environment"
echo " stop stop a shell with an environment loaded"
echo " view activate a view"
echo ""
echo "Type 'uenv command --help' for more information and examples for a specific command, e.g."
echo " uenv start --help"
echo " uenv image find --help"
}
if [ "$1" = "--version" ]; then
echo "@@version@@";
else
flags=""
while [[ $# -gt 0 ]]; do
case $1 in
-?*|--*)
flags="$flags $1"
shift
;;
*)
break
;;
esac
done
if [[ $# -eq 0 ]]; then
uenv_usage;
elif [ "$1" = "image" ]; then
shift;
$UENV_IMG_CMD $flags "$@"
elif [[ " $* " =~ [[:space:]](-h|--help)[[:space:]] ]]; then
echo "$($UENV_CMD $flags "$@")"
else
eval "$($UENV_CMD $flags "$@")"
fi
fi
unset -f uenv_usage
return $_exitcode
}
export -f uenv