diff options
author | Steve Manuel <nilslice@gmail.com> | 2017-01-19 09:09:44 -0800 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2017-01-19 09:09:44 -0800 |
commit | 4aae7bc1ebe1f2e51322ff8a991c7fa6f3c48168 (patch) | |
tree | b67b531f2b9d30df2b8879010c6fe1b7594955bd /cmd/ponzu/usage.go | |
parent | e397126da64633910a45631bced499943d1443a6 (diff) |
adding upgrade and version to CLI usage and help command, fixing issue #31 with ponzu version printing project version
Diffstat (limited to 'cmd/ponzu/usage.go')
-rw-r--r-- | cmd/ponzu/usage.go | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/cmd/ponzu/usage.go b/cmd/ponzu/usage.go index c53ade9..a2f6e1c 100644 --- a/cmd/ponzu/usage.go +++ b/cmd/ponzu/usage.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "io/ioutil" + "os" "path/filepath" "time" ) @@ -131,10 +132,47 @@ var usageRun = ` ` -func ponzu() (map[string]interface{}, error) { +var usageUpgrade = ` +upgrade + + Will backup your own custom project code (like content, addons, uploads, etc) so + we can safely re-clone Ponzu from the latest version you have or from the network + if necessary. Before running '$ ponzu upgrade', you should update the 'ponzu' + package by running '$ go get -u github.com/ponzu-cms/ponzu/...' + + Example: + $ ponzu upgrade + + +` + +var usageVersion = ` +[--cli] version, v + + Prints the version of Ponzu your project is using. Must be called from + within a Ponzu project directory. + + Example: + $ ponzu version + > Ponzu v0.7.1 + (or) + $ ponzu --cli version + > Ponzu v0.7.2 + + +` + +func ponzu(isCLI bool) (map[string]interface{}, error) { kv := make(map[string]interface{}) - b, err := ioutil.ReadFile(filepath.Join("cmd", "ponzu", "ponzu.json")) + info := filepath.Join("cmd", "ponzu", "ponzu.json") + if isCLI { + gopath := os.Getenv("GOPATH") + repo := filepath.Join(gopath, "src", "github.com", "ponzu-cms", "ponzu") + info = filepath.Join(repo, "cmd", "ponzu", "ponzu.json") + } + + b, err := ioutil.ReadFile(info) if err != nil { return nil, err } |