Repository: nats-io/nsc
Pull request #5 (2018-11-26 23:05:40)

wip self-update


Patch:
diff --git a/.coveralls.yml b/.coveralls.yml
deleted file mode 100644
index e61a1e2..0000000
--- a/.coveralls.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-service_name: travis-pro
-repo_token: 1fLyEVGu6k7PnbRZX6TsrZf751O7GhB5u
\ No newline at end of file
diff --git a/.goreleaser.yml b/.goreleaser.yml
index 1b9b8cf..f42e17f 100644
--- a/.goreleaser.yml
+++ b/.goreleaser.yml
@@ -7,11 +7,12 @@ release:
   draft: true
 builds:
 - main: ./main.go
-  ldflags: "-X github.com/nats-io/nsc/cmd.VERSION={{.Tag}}_{{.Commit}}"
+  ldflags: "-X main.version={{.Tag}}_{{.Commit}}"
   binary: nsc
   goos:
   - darwin
   - linux
+  - windows
   goarch:
   - amd64
 
diff --git a/.travis.yml b/.travis.yml
index 263d3dc..190b858 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,17 +5,10 @@ go:
 git:
   depth: false
 
+env:
+  - GO111MODULE=on
+
 install:
-  - go get github.com/nats-io/nkeys
-  - go get github.com/nats-io/jwt
-  - go get github.com/AlecAivazis/survey
-  - go get github.com/dustin/go-humanize
-  - go get github.com/mitchellh/go-homedir
-  - go get github.com/mitchellh/go-wordwrap
-  - go get github.com/spf13/cobra
-  - go get github.com/stretchr/testify/assert
-  - go get github.com/xlab/tablewriter
-  - go get github.com/spf13/viper
   - go get github.com/mattn/goveralls
   - go get github.com/wadey/gocovmerge
 
@@ -43,5 +36,5 @@ deploy:
   skip_cleanup: true
   script: curl -sL http://git.io/goreleaser | bash
   on:
-    tags: true
+#    tags: true
     condition: $TRAVIS_OS_NAME = linux
\ No newline at end of file
diff --git a/cmd/add.go b/cmd/add.go
index c4cd805..02a134f 100644
--- a/cmd/add.go
+++ b/cmd/add.go
@@ -26,5 +26,5 @@ var addCmd = &cobra.Command{
 }
 
 func init() {
-	rootCmd.AddCommand(addCmd)
+	GetRootCmd().AddCommand(addCmd)
 }
diff --git a/cmd/delete.go b/cmd/delete.go
index 93603c8..ca25a2b 100644
--- a/cmd/delete.go
+++ b/cmd/delete.go
@@ -24,5 +24,5 @@ var deleteCmd = &cobra.Command{
 }
 
 func init() {
-	rootCmd.AddCommand(deleteCmd)
+	GetRootCmd().AddCommand(deleteCmd)
 }
diff --git a/cmd/describe.go b/cmd/describe.go
index 4762ba0..7c253cb 100644
--- a/cmd/describe.go
+++ b/cmd/describe.go
@@ -50,7 +50,7 @@ nsc describe account -n foo`,
 
 func init() {
 	describeCmd = createDescribeCmd()
-	rootCmd.AddCommand(describeCmd)
+	GetRootCmd().AddCommand(describeCmd)
 }
 
 type DescribeFile struct {
diff --git a/cmd/edit.go b/cmd/edit.go
index b286dec..f042981 100644
--- a/cmd/edit.go
+++ b/cmd/edit.go
@@ -24,5 +24,5 @@ var editCmd = &cobra.Command{
 }
 
 func init() {
-	rootCmd.AddCommand(editCmd)
+	GetRootCmd().AddCommand(editCmd)
 }
diff --git a/cmd/env.go b/cmd/env.go
index 0fb1f95..4995f9d 100644
--- a/cmd/env.go
+++ b/cmd/env.go
@@ -75,5 +75,5 @@ func createEnvCmd() *cobra.Command {
 }
 
 func init() {
-	rootCmd.AddCommand(createEnvCmd())
+	GetRootCmd().AddCommand(createEnvCmd())
 }
diff --git a/cmd/generate.go b/cmd/generate.go
index e03c1f6..8630444 100644
--- a/cmd/generate.go
+++ b/cmd/generate.go
@@ -26,5 +26,5 @@ var generateCmd = &cobra.Command{
 }
 
 func init() {
-	rootCmd.AddCommand(generateCmd)
+	GetRootCmd().AddCommand(generateCmd)
 }
diff --git a/cmd/init.go b/cmd/init.go
index 09662a9..3a0a2ad 100644
--- a/cmd/init.go
+++ b/cmd/init.go
@@ -118,7 +118,7 @@ init --interactive
 }
 
 func init() {
-	rootCmd.AddCommand(CreateInitCmd())
+	GetRootCmd().AddCommand(CreateInitCmd())
 }
 
 type InitParams struct {
diff --git a/cmd/root.go b/cmd/root.go
index d1b51df..a9543d4 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -91,7 +91,6 @@ func GetRootCmd() *cobra.Command {
 	return rootCmd
 }
 
-// rootCmd represents the base command when called without any subcommands
 var rootCmd = &cobra.Command{
 	Use:   "nsc",
 	Short: "NSC enables you to create and manage NATS account and user configurations",
@@ -99,21 +98,20 @@ var rootCmd = &cobra.Command{
 
 The nsc cli creates accounts, users, and JWT tokens that provide access
 to your users and services.`,
-	Version: Version,
 }
 
 // Execute adds all child commands to the root command and sets flags appropriately.
 // This is called by main.main(). It only needs to happen once to the rootCmd.
 func Execute() {
 	cli.SetOutput(rootCmd.OutOrStderr())
-	if err := rootCmd.Execute(); err != nil {
+	if err := GetRootCmd().Execute(); err != nil {
 		os.Exit(1)
 	}
 }
 
 func init() {
 	cobra.OnInitialize(initConfig)
-	HoistRootFlags(rootCmd)
+	HoistRootFlags(GetRootCmd())
 }
 
 // hostFlags adds persistent flags that would be added by the cobra framework
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..987076c
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,26 @@
+module github.com/nats-io/nsc
+
+require (
+	github.com/AlecAivazis/survey v1.7.0
+	github.com/blang/semver v3.5.1+incompatible
+	github.com/briandowns/spinner v0.0.0-20181029155426-195c31b675a7
+	github.com/dustin/go-humanize v1.0.0
+	github.com/fatih/color v1.7.0 // indirect
+	github.com/inconshreveable/mousetrap v1.0.0 // indirect
+	github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
+	github.com/mattn/go-colorable v0.0.9 // indirect
+	github.com/mattn/go-isatty v0.0.4 // indirect
+	github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
+	github.com/mitchellh/go-homedir v1.0.0
+	github.com/mitchellh/go-wordwrap v1.0.0
+	github.com/nats-io/jwt v0.0.0-20181124173452-b4c212c5231a
+	github.com/nats-io/nkeys v0.0.0-20181122131151-819e1865e1f6
+	github.com/pmezard/go-difflib v1.0.0 // indirect
+	github.com/rhysd/go-github-selfupdate v1.1.0
+	github.com/spf13/cobra v0.0.3
+	github.com/spf13/viper v1.2.1
+	github.com/stretchr/testify v1.2.2
+	github.com/xlab/tablewriter v0.0.0-20160610135559-80b567a11ad5
+	golang.org/x/crypto v0.0.0-20181126163421-e657309f52e7 // indirect
+	gopkg.in/AlecAivazis/survey.v1 v1.7.0 // indirect
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..de72f60
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,103 @@
+github.com/AlecAivazis/survey v1.7.0 h1:Hri7k8HCumnCO2ks0BjjYZdnLVL3b/nvfUjUUVJtHGs=
+github.com/AlecAivazis/survey v1.7.0/go.mod h1:MVECab6WqEH1aXhj8nKIwF7HEAJAj2bhhGiSjNy3wII=
+github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
+github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
+github.com/briandowns/spinner v0.0.0-20181029155426-195c31b675a7 h1:IvbBe4mOtBLz3X8n95FV5FzQqGWkrkCrfKdQxj7DkUg=
+github.com/briandowns/spinner v0.0.0-20181029155426-195c31b675a7/go.mod h1:hw/JEQBIE+c/BLI4aKM8UU8v+ZqrD3h7HC27kKt8JQU=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
+github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
+github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
+github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
+github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
+github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
+github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
+github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
+github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
+github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
+github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
+github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
+github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf h1:WfD7VjIE6z8dIvMsI4/s+1qr5EL+zoIGev1BQj1eoJ8=
+github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf/go.mod h1:hyb9oH7vZsitZCiBt0ZvifOrB+qc8PS5IiilCIb87rg=
+github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
+github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
+github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
+github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY=
+github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
+github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
+github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
+github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
+github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
+github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
+github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
+github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0=
+github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
+github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4=
+github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
+github.com/mitchellh/mapstructure v1.0.0 h1:vVpGvMXJPqSDh2VYHF7gsfQj8Ncx+Xw5Y1KHeTRY+7I=
+github.com/mitchellh/mapstructure v1.0.0/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
+github.com/nats-io/jwt v0.0.0-20181124173452-b4c212c5231a h1:C9fdEgfkGSv6Q5ARp9YOjgEGbWUcUNnAN3lrX/+xwcY=
+github.com/nats-io/jwt v0.0.0-20181124173452-b4c212c5231a/go.mod h1:Zz0yk+BmWnLzEXz85TpyVuPCIzHNNAaQVZ3EiSlfhcs=
+github.com/nats-io/nkeys v0.0.0-20181122131151-819e1865e1f6 h1:DSJdx3SJYK8PTpZA4C5e38Oq48nRIH0JrQVsxPijy3Q=
+github.com/nats-io/nkeys v0.0.0-20181122131151-819e1865e1f6/go.mod h1:/5AG7AMgoe6jJRxS8l8qz974c6zxp5ApcV7VkXwSciY=
+github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
+github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
+github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
+github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/rhysd/go-github-selfupdate v1.1.0 h1:+aMomy69YCYxJ6kr13nYIgAJWSB1kHK5M5YpbmjQkWo=
+github.com/rhysd/go-github-selfupdate v1.1.0/go.mod h1:jbfShZ+Nl3IHUgr77kwQjObcWf1z961UAoD6p5LrPBU=
+github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
+github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
+github.com/spf13/cast v1.2.0 h1:HHl1DSRbEQN2i8tJmtS6ViPyHx35+p51amrdsiTCrkg=
+github.com/spf13/cast v1.2.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg=
+github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8=
+github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
+github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
+github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
+github.com/spf13/pflag v1.0.2 h1:Fy0orTDgHdbnzHcsOgfCN4LtHf0ec3wwtiwJqwvf3Gc=
+github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
+github.com/spf13/viper v1.2.1 h1:bIcUwXqLseLF3BDAZduuNfekWG87ibtFxi59Bq+oI9M=
+github.com/spf13/viper v1.2.1/go.mod h1:P4AexN0a+C9tGAnUFNwDMYYZv3pjFuvmeiMyKRaNVlI=
+github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
+github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
+github.com/tcnksm/go-gitconfig v0.1.2 h1:iiDhRitByXAEyjgBqsKi9QU4o2TNtv9kPP3RgPgXBPw=
+github.com/tcnksm/go-gitconfig v0.1.2/go.mod h1:/8EhP4H7oJZdIPyT+/UIsG87kTzrzM4UsLGSItWYCpE=
+github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok=
+github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
+github.com/xlab/tablewriter v0.0.0-20160610135559-80b567a11ad5 h1:gmD7q6cCJfBbcuobWQe/KzLsd9Cd3amS1Mq5f3uU1qo=
+github.com/xlab/tablewriter v0.0.0-20160610135559-80b567a11ad5/go.mod h1:fVwOndYN3s5IaGlMucfgxwMhqwcaJtlGejBU6zX6Yxw=
+golang.org/x/crypto v0.0.0-20181126163421-e657309f52e7 h1:70UTJTdHsz+jRjphEW+is2SdxjhZL1AdKsewqjYzcQU=
+golang.org/x/crypto v0.0.0-20181126163421-e657309f52e7/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181108082009-03003ca0c849 h1:FSqE2GGG7wzsYUsWiQ8MZrvEd1EOyU3NCF0AW3Wtltg=
+golang.org/x/net v0.0.0-20181108082009-03003ca0c849/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288 h1:JIqe8uIcRBHXDQVvZtHwp80ai3Lw3IJAeJEs55Dc1W0=
+golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
+golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20180906133057-8cf3aee42992 h1:BH3eQWeGbwRU2+wxxuuPOdFBmaiBH81O8BugSjHeTFg=
+golang.org/x/sys v0.0.0-20180906133057-8cf3aee42992/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 h1:YoY1wS6JYVRpIfFngRf2HHo9R9dAne3xbkGOQ5rJXjU=
+golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+gopkg.in/AlecAivazis/survey.v1 v1.7.0 h1:Gr+2QDJ4t2YifLZBDpyq98f4+KcXYbNadCPqwxAdLB4=
+gopkg.in/AlecAivazis/survey.v1 v1.7.0/go.mod h1:2Ehl7OqkBl3Xb8VmC4oFW2bItAhnUfzIjrOzwRxCrOU=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
+gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
+gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
+gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/main.go b/main.go
index c45286a..d94a71a 100644
--- a/main.go
+++ b/main.go
@@ -4,6 +4,10 @@ import (
 	"github.com/nats-io/nsc/cmd"
 )
 
+// the cli injects the version
+var version = "0.0.0.dev"
+
 func main() {
+	cmd.GetRootCmd().Version = version
 	cmd.Execute()
 }


Test patch:
diff --git a/cmd/test.go b/cmd/test.go
index 9eba055..575745c 100644
--- a/cmd/test.go
+++ b/cmd/test.go
@@ -84,6 +84,6 @@ func createGenerateNkey() *cobra.Command {
 }
 
 func init() {
-	rootCmd.AddCommand(testCmd)
+	GetRootCmd().AddCommand(testCmd)
 	testCmd.AddCommand(createGenerateNkey())
 }