@@ -5,6 +5,7 @@ import com.github.ajalt.clikt.command.main
5
5
import com.github.ajalt.clikt.parameters.groups.OptionGroup
6
6
import com.github.ajalt.clikt.parameters.groups.defaultByName
7
7
import com.github.ajalt.clikt.parameters.groups.groupChoice
8
+ import com.github.ajalt.clikt.parameters.options.help
8
9
import com.github.ajalt.clikt.parameters.options.option
9
10
import com.github.ajalt.clikt.parameters.types.choice
10
11
import com.jdamcd.arrivals.Arrivals
@@ -29,6 +30,7 @@ private class Cli :
29
30
private val settings: Settings by inject()
30
31
31
32
val mode by option()
33
+ .help(" Transit feed type" )
32
34
.groupChoice(" tfl" to Tfl (), " gtfs" to Gtfs ())
33
35
.defaultByName(" tfl" )
34
36
@@ -50,17 +52,17 @@ private class Cli :
50
52
is Tfl -> {
51
53
val mode = mode as Tfl
52
54
settings.mode = SettingsConfig .MODE_TFL
53
- mode.stationId ?.let { settings.tflStopId = it }
55
+ mode.station ?.let { settings.tflStopId = it }
54
56
mode.platform?.let { settings.tflPlatform = it }
55
57
mode.direction?.let { settings.tflDirection = it }
56
58
}
57
59
58
60
is Gtfs -> {
59
61
val mode = mode as Gtfs
60
62
settings.mode = SettingsConfig .MODE_GTFS
61
- mode.stopId ?.let { settings.gtfsStop = it }
62
- mode.realtimeUrl ?.let { settings.gtfsRealtime = it }
63
- mode.scheduleUrl ?.let { settings.gtfsSchedule = it }
63
+ mode.stop ?.let { settings.gtfsStop = it }
64
+ mode.realtime ?.let { settings.gtfsRealtime = it }
65
+ mode.schedule ?.let { settings.gtfsSchedule = it }
64
66
}
65
67
}
66
68
}
@@ -69,13 +71,15 @@ private class Cli :
69
71
private sealed class TransitProvider (name : String ) : OptionGroup(name)
70
72
71
73
private class Tfl : TransitProvider (" TfL options" ) {
72
- val stationId by option()
73
- val platform by option()
74
- val direction by option().choice(" inbound" , " outbound" , " all" )
74
+ val station by option().help(" Station ID" )
75
+ val platform by option().help(" Platform filter (optional)" )
76
+ val direction by option()
77
+ .choice(" inbound" , " outbound" , " all" )
78
+ .help(" Direction filter (optional)" )
75
79
}
76
80
77
81
private class Gtfs : TransitProvider (" GTFS options" ) {
78
- val stopId by option()
79
- val realtimeUrl by option()
80
- val scheduleUrl by option()
82
+ val stop by option().help( " Stop ID " )
83
+ val realtime by option().help( " GTFS-RT feed URL " )
84
+ val schedule by option().help( " GTFS schedule URL " )
81
85
}
0 commit comments