Skip to content

Commit b1ad24c

Browse files
committed
update gosurf sample config, update valid days check
1 parent 1ed4abb commit b1ad24c

3 files changed

Lines changed: 7 additions & 13 deletions

File tree

.gosurf.sample.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
area: "4716" # North America
33
region: "2081" # Southern California
44
subregion: "2953" # South San Diego
5-
days: 10 # Fetch 10 days of data for forecast, tide, etc
5+
days: 5 # Fetch 5 days of data for forecast, tide, etc

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ $ gosurf --a 4710 p --pt regions
4848
+------+-------------+
4949
```
5050

51-
52-
5351
### Forecasts
5452

5553
To get a forecast (the default subregion is Santa Barbara, CA, USA):

main.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func main() {
5757
Name: "days",
5858
Aliases: []string{"d"},
5959
Value: 7,
60-
Usage: "number of days to report (between 1 and 15)",
60+
Usage: "number of days to report (between 1 and 8)",
6161
Destination: &d,
6262
},
6363
),
@@ -205,7 +205,7 @@ func tide(aID string, rID string, srID string, d int) {
205205
}
206206

207207
if !validDayAmount(d) {
208-
fmt.Println("The number of days to report can only be between 1 and 15")
208+
fmt.Println("The number of days to report can only be between 1 and 8")
209209

210210
return
211211
}
@@ -330,7 +330,6 @@ func analysisReports(a surflinef.Analysis) []string {
330330
return rs
331331
}
332332

333-
// use merging on date https://github.com/olekukonko/tablewriter#example-6----identical-cells-merging
334333
func tideToTable(t surflinef.Tide) {
335334
table := tablewriter.NewWriter(os.Stdout)
336335
table.SetHeader([]string{"Date", "Time", "Description", "Height"})
@@ -377,11 +376,8 @@ func validPoint(p surflinef.DataPoint) bool {
377376
}
378377

379378
func validDayAmount(d int) bool {
380-
if d < 1 {
381-
return false
382-
} else if d > 15 {
383-
return false
384-
} else {
385-
return true
386-
}
379+
// I'd like to support more days (it can be up to 17)
380+
// but I have to update SurflineF to hardcode the query param
381+
// "callback" which seems to allow more than 8 days
382+
return d > 1 || d < 8
387383
}

0 commit comments

Comments
 (0)