@@ -24,6 +24,7 @@ type Options struct {
2424 ExtTmpl string // `extension` of template file
2525 StrFrom string // replace from, the from string used for the replace function
2626 StrTo string // replace to, the to string used for the replace function
27+ IntV int // int var
2728 Batch time.Duration // batch interval
2829 Debug int // debugging `level`
2930}
@@ -56,6 +57,8 @@ func initVars() {
5657 "replace from, the from string used for the replace function")
5758 flag.StringVar(&Opts.StrTo, "rt", "",
5859 "replace to, the to string used for the replace function")
60+ flag.IntVar(&Opts.IntV, "intv", 0,
61+ "int var")
5962 flag.DurationVar(&Opts.Batch, "batch", 120*time.Second,
6063 "batch interval")
6164 flag.IntVar(&Opts.Debug, "d", 0,
@@ -98,6 +101,24 @@ func initVals() {
98101 len(os.Getenv("EASYGEN_RT")) != 0 {
99102 Opts.StrTo = os.Getenv("EASYGEN_RT")
100103 }
104+ if Opts.IntV == 0 ||
105+ len(os.Getenv("EASYGEN_INTV")) != 0 {
106+ if i, err := strconv.Atoi(os.Getenv("EASYGEN_INTV")); err == nil {
107+ Opts.IntV = i
108+ }
109+ }
110+ if Opts.Debug == 0 ||
111+ len(os.Getenv("EASYGEN_D")) != 0 {
112+ if i, err := strconv.Atoi(os.Getenv("EASYGEN_D")); err == nil {
113+ Opts.Debug = i
114+ }
115+ }
116+ if Opts.Debug == 0 ||
117+ len(os.Getenv("EASYGEN_DEBUG")) != 0 {
118+ if i, err := strconv.Atoi(os.Getenv("EASYGEN_DEBUG")); err == nil {
119+ Opts.Debug = i
120+ }
121+ }
101122
102123}
103124
0 commit comments