1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-11-27 00:20:27 +02:00

[#82] removed version cmd and make use of cobra.Version

This commit is contained in:
Valley
2022-07-12 12:57:36 +08:00
committed by GitHub
parent 320d1482a4
commit ce857985be
2 changed files with 7 additions and 27 deletions

View File

@@ -73,11 +73,16 @@ func New() *PocketBase {
pb := &PocketBase{
RootCmd: &cobra.Command{
Use: "pocketbase",
Short: "PocketBase CLI",
Use: "pocketbase",
Short: "PocketBase CLI",
Version: Version,
FParseErrWhitelist: cobra.FParseErrWhitelist{
UnknownFlags: true,
},
// no need to provide the default cobra completion command
CompletionOptions: cobra.CompletionOptions{
DisableDefaultCmd: true,
},
},
defaultDebug: withGoRun,
defaultDataDir: defaultDir,
@@ -85,9 +90,6 @@ func New() *PocketBase {
showStartBanner: true,
}
// no need to provide the default cobra completion command
pb.RootCmd.CompletionOptions.DisableDefaultCmd = true
// parse base flags
// (errors are ignored, since the full flags parsing happens on Execute())
pb.eagerParseFlags()
@@ -130,7 +132,6 @@ func (pb *PocketBase) ShowStartBanner(val bool) *PocketBase {
func (pb *PocketBase) Start() error {
// register system commands
pb.RootCmd.AddCommand(cmd.NewServeCommand(pb, pb.showStartBanner))
pb.RootCmd.AddCommand(cmd.NewVersionCommand(pb, Version))
pb.RootCmd.AddCommand(cmd.NewMigrateCommand(pb))
return pb.Execute()