From 4a516c4b6fd593dea923e9b23792ea0cf71e757a Mon Sep 17 00:00:00 2001 From: Bjarte Stien Karlsen Date: Fri, 10 Nov 2023 12:13:47 +0100 Subject: [PATCH] create paths if they do not exist --- internal/command/result.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/command/result.go b/internal/command/result.go index fadb0c164..b39758094 100644 --- a/internal/command/result.go +++ b/internal/command/result.go @@ -87,6 +87,11 @@ func outputResult(result string, saveFlag string, formatFlag string, filterFlag Fs: afero.NewOsFs(), } + err := af.MkdirAll(saveFlag, 0644) + if err != nil { + return err + } + fmt.Printf("%s result saved to: %s \n", output.SaveEmoji(), saveFlag) return af.WriteFile(saveFlag, []byte(result), 0644) }