mirror of
https://github.com/dolthub/dolt.git
synced 2026-03-13 19:29:58 -05:00
add --old-format flag to dolt init
This commit is contained in:
@@ -100,7 +100,6 @@ const (
|
||||
BranchParam = "branch"
|
||||
TrackFlag = "track"
|
||||
AmendFlag = "amend"
|
||||
NewFormatFlag = "new-format"
|
||||
CommitFlag = "commit"
|
||||
NoCommitFlag = "no-commit"
|
||||
NoEditFlag = "no-edit"
|
||||
|
||||
@@ -32,6 +32,8 @@ const (
|
||||
emailParamName = "email"
|
||||
usernameParamName = "name"
|
||||
initBranchParamName = "initial-branch"
|
||||
newFormatFlag = "new-format"
|
||||
oldFormatFlag = "old-format"
|
||||
)
|
||||
|
||||
var initDocs = cli.CommandDocumentationContent{
|
||||
@@ -75,7 +77,8 @@ func (cmd InitCmd) ArgParser() *argparser.ArgParser {
|
||||
ap.SupportsString(emailParamName, "", "email", fmt.Sprintf("The email address used. If not provided will be taken from {{.EmphasisLeft}}%s{{.EmphasisRight}} in the global config.", env.UserEmailKey))
|
||||
ap.SupportsString(cli.DateParam, "", "date", "Specify the date used in the initial commit. If not specified the current system time is used.")
|
||||
ap.SupportsString(initBranchParamName, "b", "branch", fmt.Sprintf("The branch name used to initialize this database. If not provided will be taken from {{.EmphasisLeft}}%s{{.EmphasisRight}} in the global config. If unset, the default initialized branch will be named '%s'.", env.InitBranchName, env.DefaultInitBranch))
|
||||
ap.SupportsFlag(cli.NewFormatFlag, "", fmt.Sprintf("Specify this flag to use the new storage format (%s).", types.Format_DOLT.VersionString()))
|
||||
ap.SupportsFlag(newFormatFlag, "", fmt.Sprintf("Specify this flag to use the new storage format (%s).", types.Format_DOLT.VersionString()))
|
||||
ap.SupportsFlag(oldFormatFlag, "", fmt.Sprintf("Specify this flag to use the old storage format (%s).", types.Format_LD_1.VersionString()))
|
||||
return ap
|
||||
}
|
||||
|
||||
@@ -89,9 +92,15 @@ func (cmd InitCmd) Exec(ctx context.Context, commandStr string, args []string, d
|
||||
cli.PrintErrln(color.RedString("This directory has already been initialized."))
|
||||
return 1
|
||||
}
|
||||
|
||||
if apr.Contains(cli.NewFormatFlag) {
|
||||
if apr.Contains(newFormatFlag) && apr.Contains(oldFormatFlag) {
|
||||
e := fmt.Sprintf("options %s and %s are mutually exclusive", newFormatFlag, oldFormatFlag)
|
||||
cli.PrintErrln(color.RedString(e))
|
||||
return 1
|
||||
}
|
||||
if apr.Contains(newFormatFlag) {
|
||||
types.Format_Default = types.Format_DOLT
|
||||
} else if apr.Contains(oldFormatFlag) {
|
||||
types.Format_Default = types.Format_LD_1
|
||||
}
|
||||
|
||||
name, _ := apr.GetValue(usernameParamName)
|
||||
|
||||
Reference in New Issue
Block a user