diff --git a/hdiet.go b/hdiet.go index 33f4d7a..d14737f 100644 --- a/hdiet.go +++ b/hdiet.go @@ -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) } }