Skip to content

Commit

Permalink
Rename flags to be more specific.
Browse files Browse the repository at this point in the history
  • Loading branch information
btmura committed Sep 7, 2020
1 parent 7aeaf92 commit 277790a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cmd/ponzi2/ponzi2.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@ import (
)

var (
token = flag.String("token", "", "IEX API token required on requests.")
enableChartCache = flag.Bool("enable_chart_cache", true, "Whether to enable the chart cache.")
dumpAPIResponses = flag.Bool("dump_api_responses", false, "Dump API responses to txt files.")
iexAPIToken = flag.String("iex_api_token", "", "IEX API Token required on requests.")
enableIEXChartCache = flag.Bool("enable_iex_chart_cache", true, "Whether to enable the IEX chart cache.")
dumpIEXAPIResponses = flag.Bool("dump_iex_api_responses", false, "Dump API responses to txt files.")
)

func main() {
flag.Parse()

switch {
case *enableChartCache:
case *enableIEXChartCache:
cache, err := iex.OpenGOBChartCache()
if err != nil {
logger.Fatal(err)
}
c := iex.NewClient(cache, *dumpAPIResponses)
a := app.New(c, *token)
c := iex.NewClient(cache, *dumpIEXAPIResponses)
a := app.New(c, *iexAPIToken)
logger.Fatal(a.Run())

default:
c := iex.NewClient(new(iex.NoOpChartCache), *dumpAPIResponses)
a := app.New(c, *token)
c := iex.NewClient(new(iex.NoOpChartCache), *dumpIEXAPIResponses)
a := app.New(c, *iexAPIToken)
logger.Fatal(a.Run())
}
}

0 comments on commit 277790a

Please sign in to comment.