Skip to content

fix(envbuilder.go)!: rename MagicDirBase CLI option #389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 22, 2024
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
4 changes: 2 additions & 2 deletions envbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func Run(ctx context.Context, opts options.Options, preExec ...func()) error {
func run(ctx context.Context, opts options.Options, execArgs *execArgsInfo) error {
defer options.UnsetEnv()

workingDir := workingdir.At(opts.MagicDirBase)
workingDir := workingdir.At(opts.WorkingDirBase)

stageNumber := 0
startStage := func(format string, args ...any) func(format string, args ...any) {
Expand Down Expand Up @@ -962,7 +962,7 @@ func RunCacheProbe(ctx context.Context, opts options.Options) (v1.Image, error)
return nil, fmt.Errorf("--cache-repo must be set when using --get-cached-image")
}

workingDir := workingdir.At(opts.MagicDirBase)
workingDir := workingdir.At(opts.WorkingDirBase)

stageNumber := 0
startStage := func(format string, args ...any) func(format string, args ...any) {
Expand Down
4 changes: 2 additions & 2 deletions options/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (o *Options) SetDefaults() {
if o.BinaryPath == "" {
o.BinaryPath = "/.envbuilder/bin/envbuilder"
}
if o.MagicDirBase == "" {
o.MagicDirBase = workingdir.Default.Path()
if o.WorkingDirBase == "" {
o.WorkingDirBase = workingdir.Default.Path()
}
}
2 changes: 1 addition & 1 deletion options/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func TestOptions_SetDefaults(t *testing.T) {
Filesystem: chmodfs.New(osfs.New("/")),
GitURL: "",
WorkspaceFolder: options.EmptyWorkspaceDir,
MagicDirBase: "/.envbuilder",
WorkingDirBase: "/.envbuilder",
BinaryPath: "/.envbuilder/bin/envbuilder",
}

Expand Down
4 changes: 2 additions & 2 deletions options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ type Options struct {
// GetCachedImage is true.
BinaryPath string

// MagicDirBase is the path to the directory where all envbuilder files should be
// WorkingDirBase is the path to the directory where all envbuilder files should be
// stored. By default, this is set to `/.envbuilder`. This is intentionally
// excluded from the CLI options.
MagicDirBase string
WorkingDirBase string
}

const envPrefix = "ENVBUILDER_"
Expand Down