add --quiet global option

This commit is contained in:
Cory Bennett
2017-09-04 18:12:32 -07:00
parent c0358eb67c
commit c226077320
23 changed files with 97 additions and 46 deletions
+5 -3
View File
@@ -29,7 +29,7 @@ func CmdExportTemplatesRegistry() *jiracli.CommandRegistryEntry {
return CmdExportTemplatesUsage(cmd, &opts)
},
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
return CmdExportTemplates(&opts)
return CmdExportTemplates(globals, &opts)
},
}
}
@@ -42,7 +42,7 @@ func CmdExportTemplatesUsage(cmd *kingpin.CmdClause, opts *ExportTemplatesOption
}
// CmdExportTemplates will export templates to directory
func CmdExportTemplates(opts *ExportTemplatesOptions) error {
func CmdExportTemplates(globals *jiracli.GlobalOptions, opts *ExportTemplatesOptions) error {
if err := os.MkdirAll(opts.Dir, 0755); err != nil {
return err
}
@@ -62,7 +62,9 @@ func CmdExportTemplates(opts *ExportTemplatesOptions) error {
return err
}
defer fh.Close()
log.Noticef("Creating %s", templateFile)
if !globals.Quiet.Value {
log.Noticef("Creating %s", templateFile)
}
fh.Write([]byte(template))
}
return nil