Skip to content

Commit 1e1d0ee

Browse files
committed
add: changes
1 parent 33cb0ff commit 1e1d0ee

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

cmd/root.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ var (
1919
var rootCmd = &cobra.Command{
2020
Use: "bootstrap",
2121
Short: "Scaffold and manage production-ready Go services.",
22-
Long: `BootstrapCLI is a project lifecycle tool for Go services,
22+
Long: `BootstrapCLI is a project lifecycle tool for Go services.
2323
It helps you create, configure, and evolve Go projects using
24-
opinionated defaults, a clear project structure, and
25-
declarative configuration.`,
26-
Version: Version,
24+
opinionated defaults and a clear project structure.`,
2725
Run: func(cmd *cobra.Command, args []string) {
26+
v, _ := cmd.Flags().GetBool("version")
27+
if v {
28+
fmt.Print(cmd.VersionTemplate())
29+
return
30+
}
2831
_ = cmd.Help()
2932
},
3033
}
@@ -36,7 +39,8 @@ func Execute() {
3639
}
3740

3841
func init() {
39-
rootCmd.Version = Version
42+
rootCmd.Flags().BoolP("version", "v", false, "print version information")
43+
4044
rootCmd.SetVersionTemplate(
4145
fmt.Sprintf(
4246
"bootstrap-cli %s\nCommit: %s\nBuilt: %s\n",

0 commit comments

Comments
 (0)