add flag -nodisplay to 'show' command
This commit is contained in:
parent
30e1bc8250
commit
24dcb9702a
12
hdiet.go
12
hdiet.go
|
@ -131,8 +131,9 @@ func process(file string) ([]point, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type showFlags struct {
|
type showFlags struct {
|
||||||
from DateFlag
|
from DateFlag
|
||||||
to DateFlag
|
to DateFlag
|
||||||
|
nodisplay bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func show(args showFlags) error {
|
func show(args showFlags) error {
|
||||||
|
@ -172,7 +173,11 @@ func show(args showFlags) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return openGraphFile()
|
if args.nodisplay {
|
||||||
|
return nil
|
||||||
|
} else {
|
||||||
|
return openGraphFile()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func showCommand() (goutil.CommandFlagsInit, goutil.CommandFunc) {
|
func showCommand() (goutil.CommandFlagsInit, goutil.CommandFunc) {
|
||||||
|
@ -180,6 +185,7 @@ func showCommand() (goutil.CommandFlagsInit, goutil.CommandFunc) {
|
||||||
flagsInit := func(s *flag.FlagSet) {
|
flagsInit := func(s *flag.FlagSet) {
|
||||||
s.Var(&sf.from, "from", "YYYY-MM-DD (optional)")
|
s.Var(&sf.from, "from", "YYYY-MM-DD (optional)")
|
||||||
s.Var(&sf.to, "to", "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) }
|
return flagsInit, func([]string) error { return show(sf) }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user