1
1
#! /bin/bash
2
+
2
3
usage () {
3
4
cat << EOF
4
5
usage: gvp [COMMAND]
@@ -16,70 +17,33 @@ SYNOPSIS
16
17
USAGE
17
18
Since gvp is a script, env changes will not happen unless you source them.
18
19
19
- $ gvp init
20
- $ source gvp in
21
- $ source gvp out
20
+ $ source gvp
22
21
23
22
COMMANDS
24
- init Creates the .godeps directory.
25
- in Modifies GOPATH and GOBIN to use the .godeps directory and sets the GVP_NAME variable.
26
- This can also be used to execute a comand in the environment without sourcing it.
27
- For example: "gvp in go build"
28
- out Restores the previous GOPATH and GOBIN and unsets GVP_NAME.
29
- version outputs version information.
30
- help prints this message.
23
+ source gvp Modifies GOPATH and GOBIN to use the .godeps directory.
24
+ gvp version Outputs version information.
25
+ gvp help Prints this message.
31
26
EOF
32
27
}
33
28
34
- if [[ " $1 " != " in" && " $# " -ne 1 ]]; then
35
- usage
36
- exit 1
37
- fi
38
-
39
- case " $1 " in
29
+ case " ${1:- " in" } " in
40
30
" init" )
31
+ echo " >> This command is deprecated, just run 'source gvp'."
41
32
mkdir -p .godeps/{src,pkg,bin}
42
33
;;
43
34
" version" )
44
35
echo " >> gvp v0.1.0"
45
36
;;
46
37
" in" )
47
- if [[ -n $GVP_NAME ]] ; then kill -INT $$ ; fi
38
+ mkdir -p .godeps/{src,pkg,bin}
48
39
49
40
GVP_DIR=" $( pwd) /.godeps"
50
-
51
- if [[ ! -d $GVP_DIR ]]; then
52
- echo ' >> Directory .godeps not found. Run `gvp init` first.'
53
- kill -INT $$
54
- fi
55
-
56
- GVP_OLD_GOPATH=$GOPATH
57
- GVP_OLD_GOBIN=$GOBIN
58
- GVP_OLD_PATH=$PATH
59
- export GVP_OLD_GOPATH GVP_OLD_GOBIN PATH
60
-
61
- GVP_NAME=$( basename $( pwd) )
62
41
GOBIN=" $GVP_DIR /bin"
63
42
GOPATH=" $GVP_DIR :$PWD "
64
43
PATH=" $GOBIN :$PATH "
65
44
66
45
export GOBIN GOPATH GVP_NAME PATH
67
46
echo " >> Local GOPATH set."
68
-
69
- if [[ -n $2 ]]; then
70
- eval ${@: 2}
71
- fi
72
- ;;
73
- " out" )
74
- if [[ -z $GVP_NAME ]]; then kill -INT $$ ; fi
75
-
76
- GOBIN=$GVP_OLD_GOBIN
77
- GOPATH=$GVP_OLD_GOPATH
78
- PATH=$GVP_OLD_PATH
79
-
80
- export PATH GOPATH GOBIN
81
- unset GVP_OLD_GOPATH GVP_OLD_GOBIN GVP_OLD_PATH GVP_NAME
82
- echo " >> Reverted to system GOPATH."
83
47
;;
84
48
" help" )
85
49
usage
@@ -93,8 +57,8 @@ case "$1" in
93
57
gvp-$plugin $@ &&
94
58
exit
95
59
else
60
+ echo " >> Unknown command."
96
61
usage && exit 1
97
62
fi
98
63
;;
99
-
100
64
esac
0 commit comments