aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgutmet <me.git@gutmet.org>2019-06-26 23:05:30 +0200
committergutmet <me.git@gutmet.org>2019-06-26 23:05:30 +0200
commit24dcb9702a674646c6a1107c76312fe10307eeca (patch)
tree92cbdd2b0384d9b64d45c2d908b48736224c8e0e
parent30e1bc8250382e73fec63f26da383bd5fff4c6c2 (diff)
downloadhdiet-24dcb9702a674646c6a1107c76312fe10307eeca.tar.gz
add flag -nodisplay to 'show' command
-rw-r--r--hdiet.go12
1 files changed, 9 insertions, 3 deletions
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) }
}