Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion internal/boxcli/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type updateCmdFlags struct {
config configFlags
sync bool
allProjects bool
noInstall bool
}

func updateCmd() *cobra.Command {
Expand Down Expand Up @@ -49,6 +50,12 @@ func updateCmd() *cobra.Command {
false,
"update all projects in the working directory, recursively.",
)
command.Flags().BoolVar(
&flags.noInstall,
"no-install",
false,
"update lockfile but don't install anything",
)
return command
}

Expand All @@ -75,7 +82,8 @@ func updateCmdFunc(cmd *cobra.Command, args []string, flags *updateCmdFlags) err
}

return box.Update(cmd.Context(), devopt.UpdateOpts{
Pkgs: args,
Pkgs: args,
NoInstall: flags.noInstall,
})
}

Expand Down
1 change: 1 addition & 0 deletions internal/devbox/devopt/devboxopts.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ type AddOpts struct {

type UpdateOpts struct {
Pkgs []string
NoInstall bool
IgnoreMissingPackages bool
}

Expand Down
5 changes: 3 additions & 2 deletions internal/devbox/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,9 @@ const (
install installMode = "install"
uninstall installMode = "uninstall"
// update is both install new package version and uninstall old package version
update installMode = "update"
ensure installMode = "ensure"
update installMode = "update"
ensure installMode = "ensure"
noInstall installMode = "noInstall"
)

// ensureStateIsUpToDate ensures the Devbox project state is up to date.
Expand Down
6 changes: 5 additions & 1 deletion internal/devbox/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ func (d *Devbox) Update(ctx context.Context, opts devopt.UpdateOpts) error {
if err := d.updateStdenv(); err != nil {
return err
}
if err := d.ensureStateIsUpToDate(ctx, update); err != nil {
mode := update
if opts.NoInstall {
mode = noInstall
}
if err := d.ensureStateIsUpToDate(ctx, mode); err != nil {
return err
}

Expand Down
Loading