zarf icon indicating copy to clipboard operation
zarf copied to clipboard

Remove temporary directory flag

Open phillebaba opened this issue 4 months ago • 0 comments

Describe what should be investigated or refactored

Currently we have a --tmpdir flag in the root command. This allows users to set a custom directory to use for their temp directory.

Using this flag requires use to pass the configured flag every time we want to create a temporary directory.

https://github.com/zarf-dev/zarf/blob/87dfbcdc04381263a95fa77d8a40f28b469c5957/src/pkg/packager/sources/url.go#L56

There is already a standard to override the temporary directory used by go when creating a new directory.

On Unix systems, it returns $TMPDIR if non-empty, else /tmp. On Windows, it uses GetTempPath, returning the first non-empty value from %TMP%, %TEMP%, %USERPROFILE%, or the Windows directory.

We should remove the flag and tell people to use these environment variables instead if they want to override the temp directory. We should also remove use to the helpers function to create the temporary directory in favor of stdlib.

Links to any relevant code

https://github.com/zarf-dev/zarf/blob/87dfbcdc04381263a95fa77d8a40f28b469c5957/src/cmd/root.go#L131

phillebaba avatar Oct 09 '24 20:10 phillebaba