Skip to content

Commit

Permalink
add flag to machine run, use IsSpecified to set opts
Browse files Browse the repository at this point in the history
  • Loading branch information
jipperinbham committed Nov 15, 2024
1 parent eddb4ed commit 8f0f5e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/command/command_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ func DetermineImage(ctx context.Context, appName string, imageOrPath string) (im
if cfg != nil && cfg.Experimental != nil {
opts.UseZstd = cfg.Experimental.UseZstd
}

// use-zstd passed through flags takes precedence over the one set in config
if useZstd := flag.GetBool(ctx, "use-zstd"); useZstd {
opts.UseZstd = useZstd
if flag.IsSpecified(ctx, "use-zstd") {
opts.UseZstd = flag.GetBool(ctx, "use-zstd")
}

img, err = resolver.BuildImage(ctx, io, opts)
Expand Down
4 changes: 4 additions & 0 deletions internal/command/machine/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ var runOrCreateFlags = flag.Set{
Description: "Enable LSVD for this machine",
Hidden: true,
},
flag.Bool{
Name: "use-zstd",
Description: "Enable zstd compression for the image",
},
}

func soManyErrors(args ...interface{}) error {
Expand Down

0 comments on commit 8f0f5e5

Please sign in to comment.