Skip to content

Commit

Permalink
Merge pull request #7727 from dolthub/bh/version-refactor
Browse files Browse the repository at this point in the history
Version Command Refactor
  • Loading branch information
bheni authored Apr 10, 2024
2 parents 8dcd3bb + f9e10ab commit 77691dd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion go/cmd/dolt/commands/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ The out-of-date check can be disabled by running {{.EmphasisLeft}}dolt config --
}

type VersionCmd struct {
BinaryName string
VersionStr string
}

Expand Down Expand Up @@ -90,7 +91,15 @@ func (cmd VersionCmd) Exec(ctx context.Context, commandStr string, args []string
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, versionDocs, ap))
apr := cli.ParseArgsOrDie(ap, args, help)

cli.Println("dolt version", cmd.VersionStr)
return cmd.ExecWithArgParser(ctx, apr, usage, dEnv)
}

func (cmd VersionCmd) ExecWithArgParser(ctx context.Context, apr *argparser.ArgParseResults, usage cli.UsagePrinter, dEnv *env.DoltEnv) int {
binName := "dolt"
if cmd.BinaryName != "" {
binName = cmd.BinaryName
}
cli.Printf("%s version %s\n", binName, cmd.VersionStr)

versionCheckDisabled := dEnv.Config.GetStringOrDefault(config.VersionCheckDisabled, "false")
if versionCheckDisabled == "false" {
Expand Down

0 comments on commit 77691dd

Please sign in to comment.