Skip to content

Commit

Permalink
adding a version, because why not
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcquillan committed Dec 15, 2017
1 parent 0f28134 commit 635457f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func Validate(options *Options) {
}

// validate command
if !util.Member(options.Command, "get,groups,streams,help") {
if !util.Member(options.Command, "get,groups,streams,version,help") {
options.Command = "help"
options.Group = ""
}
Expand Down
4 changes: 3 additions & 1 deletion fetch/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

// Help - display the help
func Help(options config.Options) {
func Help(options config.Options, version string) {

if options.Group == "" {
options.Group = "less"
Expand All @@ -30,6 +30,7 @@ func Help(options config.Options) {
fmt.Println(" lawsg groups [options]")
fmt.Println(" lawsg streams <group name> [options]")
fmt.Println(" lawsg get <group name> [options]")
fmt.Println(" lawsg version")
fmt.Println("")
}

Expand Down Expand Up @@ -198,6 +199,7 @@ func Help(options config.Options) {

if util.Member(options.Group, "about,more,docs") {
fmt.Println("ABOUT:")
fmt.Println(" lawsg", version)
fmt.Println(" Free to Use and Contribute via the MIT License")
fmt.Println(" Maintained by Matt McQuillan")
fmt.Println(" https://github.com/mmcquillan/lawsg")
Expand Down
14 changes: 14 additions & 0 deletions fetch/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package fetch

import (
"fmt"
)

func Version(version string) {
if version == "" {
version = "(compiled)"
}
fmt.Println("")
fmt.Println("lawsg", version)
fmt.Println("")
}
6 changes: 5 additions & 1 deletion lawsg.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"github.com/mmcquillan/lawsg/fetch"
)

var version string

func main() {
config.Aws()
var options config.Options
Expand All @@ -21,7 +23,9 @@ func main() {
fetch.Streams(options)
case "get":
fetch.Logs(options)
case "version":
fetch.Version(version)
default:
fetch.Help(options)
fetch.Help(options, version)
}
}

0 comments on commit 635457f

Please sign in to comment.