Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
Fix version command
Browse files Browse the repository at this point in the history
  • Loading branch information
ahelmy committed Jan 7, 2024
1 parent b5edd47 commit 107d62e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,14 @@ xdev -h
Developer Swiss Army Knife tools X for anything.

Usage:
xdev [flags]
xdev [command]

Available Commands:
base64decoder Decode base64 string. Alias: b64d
base64decoder Decode base64 string. Alias: b64d
base64encoder Encode string to base64. Alias: b64e
completion Generate the autocompletion script for the specified shell
hash Hash a string
help Help about any command
json JSON indentation and minification
json2yaml Convert JSON to YAML. Alias: j2y
Expand All @@ -116,7 +118,8 @@ base64decoder Decode base64 string. Alias: b64d
yaml2json Convert YAML to JSON. Alias: y2j

Flags:
-h, --help help for xdev
-h, --help help for xdev
-v, --version Print the version number

Use "xdev [command] --help" for more information about a command.
```
Expand Down
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ var rootCmd = &cobra.Command{
if versionFlag, _ := cmd.Flags().GetBool("version"); versionFlag {
fmt.Printf("Your App Version: %s\nCommit: %s\nBuild Date: %s\n", app.AppVersion, app.GitCommit, app.BuildTime)
os.Exit(0)
} else {
cmd.Help()
}
},
}
Expand All @@ -38,7 +40,6 @@ func Execute() {

func init() {
rootCmd.Flags().BoolP("version", "v", false, "Print the version number")
rootCmd.MarkFlagRequired("version")
// Here you will define your flags and configuration settings.
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.
Expand Down

0 comments on commit 107d62e

Please sign in to comment.