Skip to content

Commit

Permalink
Version 0.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Nemec committed Jun 28, 2018
1 parent 46a4622 commit 2445134
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"nanny/pkg/nanny"
"nanny/pkg/notifier"
"nanny/pkg/storage"
"nanny/pkg/version"

"github.com/gorilla/mux"
log "github.com/mgutz/logxi"
Expand Down Expand Up @@ -234,7 +235,7 @@ func depWrap(nanny *nanny.Nanny, notifiers notifiers, storage storage.Storage, h
// versionHandler simply returns version of this nanny.
func versionHandler(w http.ResponseWriter, req *http.Request) error {
w.WriteHeader(http.StatusOK)
_, err := io.WriteString(w, "Nanny v0.1")
_, err := io.WriteString(w, version.VersionString)
return errors.Wrap(err, "unable to reply with version")
}

Expand Down
22 changes: 22 additions & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cmd

import (
"fmt"

"nanny/pkg/version"

"github.com/spf13/cobra"
)

// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print Nanny version",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(version.VersionString)
},
}

func init() {
RootCmd.AddCommand(versionCmd)
}
7 changes: 7 additions & 0 deletions pkg/version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package version

// Version is, suprisingly nanny version.
const Version = "0.2"

// VersionString to have it nice.
const VersionString = "Nanny v" + Version

0 comments on commit 2445134

Please sign in to comment.