File tree Expand file tree Collapse file tree 4 files changed +37
-8
lines changed Expand file tree Collapse file tree 4 files changed +37
-8
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ You can create a bash alias to make looking up the next to arrive for your favor
7
7
8
8
alias nta="septa next Narberth \"Suburban Station\""
9
9
10
+ Alternatively, you can use the ` go install ` command, if you clone this repo to your implied ` GOPATH ` .
11
+
10
12
11
13
## Commands
12
14
@@ -23,7 +25,16 @@ Returns the next to arrive between the src and dest stations.
23
25
24
26
25
27
### septa stations
26
- TODO: Will list the stations.
28
+ Returns the list of stations
29
+
30
+ $ septa stations
31
+
32
+ 9th St
33
+ 30th Street Station
34
+ 49th St
35
+ Airport Terminal A
36
+ Airport Terminal B
37
+ ...
27
38
28
39
29
40
### Alerts
Original file line number Diff line number Diff line change @@ -12,9 +12,10 @@ var funcMap map[string]func(context.Context)
12
12
13
13
func init () {
14
14
funcMap = map [string ]func (context.Context ){
15
- "help" : Usage ,
16
- "next" : NextToArrive ,
17
- "version" : Version ,
15
+ "help" : Usage ,
16
+ "next" : NextToArrive ,
17
+ "stations" : Stations ,
18
+ "version" : Version ,
18
19
}
19
20
}
20
21
@@ -28,8 +29,9 @@ func Usage(ctx context.Context) {
28
29
fmt .Printf (`
29
30
Usage:
30
31
31
- septa next [from-station] [to-station]
32
- septa version ; prints the commit version
32
+ septa stations [pattern] ; list stations, or match pattern
33
+ septa next [from-station] [to-station] ; show the next to arrive
34
+ septa version ; prints the commit version
33
35
` )
34
36
35
37
}
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "context"
5
+ "fmt"
6
+
7
+ "github.com/dherbst/septa"
8
+ )
9
+
10
+ // Stations command lists the stations that acceptable for Next To Arrive.
11
+ func Stations (ctx context.Context ) {
12
+ for _ , v := range septa .Stations {
13
+ fmt .Printf ("%v\n " , v )
14
+ }
15
+ }
Original file line number Diff line number Diff line change 1
1
package septa
2
2
3
- var stations = []string {
3
+ // Stations is the list of valid station names for next to arrive
4
+ var Stations = []string {
4
5
"9th St" ,
5
6
"30th Street Station" ,
6
7
"49th St" ,
@@ -160,7 +161,7 @@ var stations = []string{
160
161
161
162
// IsValidStation returns whether the station is a valid station.
162
163
func IsValidStation (station string ) bool {
163
- for _ , v := range stations {
164
+ for _ , v := range Stations {
164
165
if station == v {
165
166
return true
166
167
}
You can’t perform that action at this time.
0 commit comments