diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/metar.go | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/cmd/metar.go b/cmd/metar.go index 6355105..ea72f70 100644 --- a/cmd/metar.go +++ b/cmd/metar.go @@ -124,7 +124,7 @@ conjunction with --until`) `Ending time for METARs (e.g. "2020-01-01T01:31:00" or "3h"), used in conjunction with --since`) metarCmd.Flags().DurationVar( - &past, "past", 0, + &past, "past", time.Hour, `Duration to retrieve METARs since (e.g. "3h")`) // location constraints @@ -154,8 +154,8 @@ reported. A higher value results in less dense results.`) &mostRecentByStation, "most-recent-by-station", "constraint", `Method for fetching most recent for each station ("constraint", "postfilter", "false")`) - metarCmd.Flags().BoolVarP( - &mostRecent, "one", "1", false, + metarCmd.Flags().BoolVar( + &mostRecent, "most-recent", false, `Only fetch the single most recently-issued METAR of all the selected stations`) } @@ -173,19 +173,14 @@ var metarCmd = &cobra.Command{ if !since.t.IsZero() || !until.t.IsZero() { reqArgs = append(reqArgs, metar.TimeRange(since.t, until.t)) - } - - dur, _ := cmd.Flags().GetDuration("past") - if dur > 0 { + } else if dur, _ := cmd.Flags().GetDuration("past"); dur > 0 { reqArgs = append(reqArgs, metar.HoursBeforeNow(dur.Hours())) } - if mostRecentByStation != "" { - reqArgs = append(reqArgs, metar.MostRecentForEachStation(mostRecentByStation)) - } - if mostRecent { reqArgs = append(reqArgs, metar.MostRecent(true)) + } else if mostRecentByStation != "" { + reqArgs = append(reqArgs, metar.MostRecentForEachStation(mostRecentByStation)) } if !rect.IsZero() { |