Create output-dir if missing

Signed-off-by: Harsimran Singh Maan <maan.harry@gmail.com>
pull/4885/head
Harsimran Singh Maan 7 years ago
parent c60abb4dd0
commit b0ba38ec81
No known key found for this signature in database
GPG Key ID: B6C55D1AAAADD656

@ -120,11 +120,10 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error {
return err return err
} }
// verify that output-dir exists if provided // create the output-dir if it doesn't exist
if t.outputDir != "" { if t.outputDir != "" {
_, err := os.Stat(t.outputDir) if err := ensureDirectoryForFile(t.outputDir);err != nil {
if os.IsNotExist(err) { return err
return fmt.Errorf("output-dir '%s' does not exist", t.outputDir)
} }
} }

Loading…
Cancel
Save