File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed
Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ Commands:
9393 oo bin [< version> ] Show go binary path by version
9494 oo build [< version> ] Build go by version
9595 oo env Output current go env
96+ oo upgrade Upgrade oo to latest version
9697
9798Options:
9899 -v, --version Output oo' s version
Original file line number Diff line number Diff line change 1+ 0.0.5
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- VERSION=' 0.0.4'
4-
53#
64# Settings
75#
@@ -20,6 +18,8 @@ VERSIONS_DIR=${ROOT_DIR}/versions
2018GOROOT_DIR=${ROOT_DIR} /go
2119GOBIN_PATH=${GOROOT_DIR} /bin/go
2220
21+ VERSION=$( cat ${ROOT_DIR} /VERSION)
22+
2323#
2424# Help
2525#
@@ -39,6 +39,7 @@ Commands:
3939 oo bin [<version>] Show go binary path by version
4040 oo build [<version>] Build go by version
4141 oo env Output current go env
42+ oo upgrade Upgrade oo to latest version
4243
4344Options:
4445 -v, --version Output oo's version
@@ -249,6 +250,15 @@ env() {
249250 exec " ${GOBIN_PATH} " env
250251}
251252
253+ #
254+ # Upgrade oo
255+ #
256+ upgrade () {
257+ command -v git > /dev/null 2>&1 || abort ' git not installed'
258+ cd ${ROOT_DIR} && git pull git://github.com/hit9/oo.git master
259+ printf ' => %s\n' $( cat ${ROOT_DIR} /VERSION)
260+ }
261+
252262#
253263# Main
254264#
267277 bin) bin $2 ;;
268278 build) build $2 ;;
269279 env) env ;;
280+ upgrade) upgrade ;;
270281 * ) use $1 ;;
271282 esac
272283fi
You can’t perform that action at this time.
0 commit comments