Skip to content

Commit

Permalink
[pocketbase#82] removed version cmd and make use of cobra.Version
Browse files Browse the repository at this point in the history
  • Loading branch information
ValleyZw authored Jul 12, 2022
1 parent 320d148 commit ce85798
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 27 deletions.
21 changes: 0 additions & 21 deletions cmd/version.go

This file was deleted.

13 changes: 7 additions & 6 deletions pocketbase.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,23 @@ 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,
defaultEncryptionEnv: "",
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()
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit ce85798

Please sign in to comment.