mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-28 03:08:53 -06:00
dolt init fails with invalid arguments (#4815)
This commit is contained in:
@@ -88,6 +88,11 @@ func (cmd InitCmd) Exec(ctx context.Context, commandStr string, args []string, d
|
||||
help, usage := cli.HelpAndUsagePrinters(cli.CommandDocsForCommandString(commandStr, initDocs, ap))
|
||||
apr := cli.ParseArgsOrDie(ap, args, help)
|
||||
|
||||
if len(apr.Args) > 0 {
|
||||
cli.PrintErrln(color.RedString("error: invalid arguments."))
|
||||
return 1
|
||||
}
|
||||
|
||||
if dEnv.HasDoltDir() {
|
||||
cli.PrintErrln(color.RedString("This directory has already been initialized."))
|
||||
return 1
|
||||
|
||||
@@ -152,6 +152,18 @@ teardown() {
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "init: running init with invalid argument or option fails" {
|
||||
set_dolt_user "baz", "baz@bash.com"
|
||||
|
||||
run dolt init invalid
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "error: invalid arguments" ]] || false
|
||||
|
||||
run dolt init --invalid
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "error: unknown option" ]] || false
|
||||
}
|
||||
|
||||
@test "init: running init with the new format, creates a new format database" {
|
||||
set_dolt_user "baz", "baz@bash.com"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user