Skip to content

Commit bbe7a31

Browse files
authored
feat(init): print success message and next steps after devbox init (#2800)
## Summary Add a success message to devbox init with next steps ## How was it tested? Run `devbox init` in a test folder, confirm the message is displayed Rerun the command, confirm the error message still displays
1 parent ab5eba0 commit bbe7a31

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

internal/boxcli/init.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,23 @@ func initCmd() *cobra.Command {
3131
Args: cobra.MaximumNArgs(1),
3232
RunE: func(cmd *cobra.Command, args []string) error {
3333
err := runInitCmd(cmd, args, flags)
34+
path := pathArg(args)
35+
if path == "" || path == "." {
36+
path, _ = os.Getwd()
37+
}
3438
if errors.Is(err, os.ErrExist) {
35-
path := pathArg(args)
36-
if path == "" || path == "." {
37-
path, _ = os.Getwd()
38-
}
3939
ux.Fwarningf(cmd.ErrOrStderr(), "devbox.json already exists in %q.", path)
40-
err = nil
40+
return nil
41+
}
42+
if err != nil {
43+
return err
4144
}
42-
return err
45+
if flags.dryRun {
46+
return nil
47+
}
48+
fmt.Fprintf(cmd.OutOrStdout(), "Created devbox.json in %s\n", path)
49+
fmt.Fprintln(cmd.OutOrStdout(), "Run `devbox add <package>` to add packages, or `devbox shell` to start a dev shell.")
50+
return nil
4351
},
4452
}
4553

0 commit comments

Comments
 (0)