add flag -nodisplay to 'show' command

This commit is contained in:
gutmet 2019-06-26 23:05:30 +02:00
parent 30e1bc8250
commit 24dcb9702a

View File

@ -131,8 +131,9 @@ func process(file string) ([]point, error) {
}
type showFlags struct {
from DateFlag
to DateFlag
from DateFlag
to DateFlag
nodisplay bool
}
func show(args showFlags) error {
@ -172,7 +173,11 @@ func show(args showFlags) error {
if err != nil {
return err
}
return openGraphFile()
if args.nodisplay {
return nil
} else {
return openGraphFile()
}
}
func showCommand() (goutil.CommandFlagsInit, goutil.CommandFunc) {
@ -180,6 +185,7 @@ func showCommand() (goutil.CommandFlagsInit, goutil.CommandFunc) {
flagsInit := func(s *flag.FlagSet) {
s.Var(&sf.from, "from", "YYYY-MM-DD (optional)")
s.Var(&sf.to, "to", "YYYY-MM-DD (optional)")
s.BoolVar(&sf.nodisplay, "nodisplay", false, "don't display graph image")
}
return flagsInit, func([]string) error { return show(sf) }
}