Implement temp file cleanup for chartify and helmfile temp files

Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-08-23 03:07:04 +00:00
co-authored by yxxhero
parent 3ce5abcc4f
commit 53ee477e20
5 changed files with 59 additions and 2 deletions
+9
View File
@@ -68,6 +68,14 @@ func NewRootCmd(globalConfig *config.GlobalOptions) (*cobra.Command, error) {
}
logger = helmexec.NewLogger(logOut, logLevel)
globalConfig.SetLogger(logger)
// Clean up old temporary files if enabled
if globalConfig.CleanupTempFiles {
if err := app.CleanupTempFiles(logger); err != nil {
logger.Warnf("Failed to cleanup temporary files: %v", err)
}
}
return nil
},
}
@@ -141,6 +149,7 @@ The name of a release can be used as a label: "--selector name=myrelease"`)
fs.BoolVar(&globalOptions.EnableLiveOutput, "enable-live-output", globalOptions.EnableLiveOutput, `Show live output from the Helm binary Stdout/Stderr into Helmfile own Stdout/Stderr.
It only applies for the Helm CLI commands, Stdout/Stderr for Hooks are still displayed only when it's execution finishes.`)
fs.BoolVarP(&globalOptions.Interactive, "interactive", "i", false, "Request confirmation before attempting to modify clusters")
fs.BoolVar(&globalOptions.CleanupTempFiles, "cleanup-temp-files", true, "Clean up temporary files and directories from previous runs on startup")
// avoid 'pflag: help requested' error (#251)
fs.BoolP("help", "h", false, "help for helmfile")
}