Skip to content

Commit

Permalink
added support for version command so that version information can b…
Browse files Browse the repository at this point in the history
…e printed to stdout

Signed-off-by: zerjioang <[email protected]>
  • Loading branch information
zerjioang committed Oct 21, 2021
1 parent 08a9205 commit 87a85c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2
0.3
14 changes: 14 additions & 0 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import (
"github.com/zerjioang/ddns-cloudflare/api"
)

const (
version = "0.3"
)

var rootCmd = &cobra.Command{
Use: "ddns-cloudflare",
Short: "CloudFlare DDNS Agent",
Expand Down Expand Up @@ -44,9 +48,19 @@ var monitorCmd = &cobra.Command{
},
}

var versionCmd = &cobra.Command{
Use: "version",
Short: "print version",
Long: `prints ddns-cloudflare agent application version`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(version)
},
}

func init() {
rootCmd.AddCommand(startCmd)
rootCmd.AddCommand(monitorCmd)
rootCmd.AddCommand(versionCmd)
}

// Execute is the main command line application entry point
Expand Down

0 comments on commit 87a85c2

Please sign in to comment.