Skip to content

Commit

Permalink
EFABee: Optional parameter for amount of upcoming departures to fetch (
Browse files Browse the repository at this point in the history
  • Loading branch information
penguwin authored and muesli committed Mar 2, 2018
1 parent 94fd3b2 commit e08ef68
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bees/efabee/efabee.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ func (mod *EFABee) Action(action bees.Action) []bees.Placeholder {

case "departures":
stop := ""
amount := 3
action.Options.Bind("stop", &stop)
action.Options.Bind("amount", &amount)

//FIXME get departures
station, err := mod.efa.FindStop(stop)
Expand All @@ -143,7 +145,7 @@ func (mod *EFABee) Action(action bees.Action) []bees.Placeholder {
}
mod.Logf("Selected stop: %s (%d)", station[0].Name, station[0].ID)

departures, err := station[0].Departures(time.Now(), 3)
departures, err := station[0].Departures(time.Now(), amount)
if err != nil {
mod.Logln("Could not retrieve departure times!")
return outs
Expand Down
6 changes: 6 additions & 0 deletions bees/efabee/efabeefactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ func (factory *EFABeeFactory) Actions() []bees.ActionDescriptor {
Type: "string",
Mandatory: true,
},
{
Name: "amount",
Description: "The amount of departures you want (Default: 3)",
Type: "int",
Mandatory: false,
},
},
},
{
Expand Down

0 comments on commit e08ef68

Please sign in to comment.