Skip to content

Commit 2f67ae8

Browse files
fix(cli): Fix project add not respecting --default flag (#949)
1 parent dd5b4dc commit 2f67ae8

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

cmd/lk/project.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func addProject(ctx context.Context, cmd *cli.Command) error {
232232
// if it's first project, make it default
233233
isDefault := false
234234
if cmd.Bool("default") || defaultProject == nil {
235-
cliConfig.DefaultProject = p.Name
235+
isDefault = true
236236
} else if !cmd.IsSet("default") {
237237
prompts = append(prompts, util.Confirm().
238238
Title("Make this project default?").
@@ -251,9 +251,10 @@ func addProject(ctx context.Context, cmd *cli.Command) error {
251251
if err != nil {
252252
return err
253253
}
254-
if isDefault {
255-
cliConfig.DefaultProject = p.Name
256-
}
254+
}
255+
256+
if isDefault {
257+
cliConfig.DefaultProject = p.Name
257258
}
258259

259260
cliConfig.Projects = append(cliConfig.Projects, p)

0 commit comments

Comments
 (0)