Commit f6fbc63a authored by Andreas Muttscheller's avatar Andreas Muttscheller

Improve help text and command documentation

parent 929a6bf5
......@@ -161,10 +161,10 @@ class APISlackBotEventHandlerWorker {
| Note: Regional trains have a unique number after the line in brackets, e.g. RB 68 (15311), where 15311 is the
| train number. If you only want to get delay information for specific trains rather than all trains for a
| line, use this in `registerDelay`.
| line, use this in `subscribeDelay`.
| ```
|
| Author: <@UEJN43CP9> Code: https://gitlab.codecentric.de/andreas.muttscheller/kafka-bahn/
| Author: <@UEJN43CP9> Support: <#CFP0G0X0U> Code: https://gitlab.codecentric.de/andreas.muttscheller/BahnDelayInformation/
|
""".stripMargin
slackApiClient.postChatMessage(
......
......@@ -73,7 +73,8 @@ class SNSChangeSlackReporter {
.flatMap { case (tti, sr) =>
sr.delayRegistration.map(d => (tti, sr, d))
}
.filter { case (tti, _, d) => d.eva == tti.eva && tti.train.matches(d.trainRegex) }
.filter { case (tti, _, d) => d.eva == tti.eva &&
(tti.train.matches(d.trainRegex) || tti.train.startsWith(d.trainRegex) || tti.train.replace(" ", "").startsWith(d.trainRegex)) }
.filter { case (tti, _, d) => d.direction.isEmpty || tti.pathTo.contains(d.direction.get) }
.filter { case (tti, _, d) => d.from.isEmpty || d.until.isEmpty ||
(d.from.isDefined && d.until.isDefined &&
......
......@@ -188,9 +188,16 @@ case object AddStation extends SlackCommand with StationFinder {
case object SubscribeDelay extends SlackCommand with StationFinder with ParameterParser {
override val cmd: String = "subscribeDelay"
override val help: String = "subscribeDelay -t <train> -s <station>"
override val help: String = "subscribeDelay -t <train> -s <station> --from 06:00 --until 10:00 --d <station> "
override val description: String =
"""Subscribe to a delay for <train> and <station>. <train> can be regex.
"""Subscribe to a delay for <train> and <station>. <train> can be regex, must match train name.
|
|--from --until --d are optional.
|
|--from --until specify the time from and until a delay should be published. Format: HH:mm
|
|--d must be a station on the route of the train, e.g. the "Darmstadt Hbf" for
| a RB train from Frankfurt Hbf to Mannheim Hbf.
|
| Example:
| subscribeDelay -t "R[BE] 6[078].*" -s "Frankfurt Hbf""""
......@@ -220,11 +227,11 @@ case object SubscribeDelay extends SlackCommand with StationFinder with Paramete
val train = paramsMap("-t")
val station = paramsMap("-s")
val from = paramsMap.getOrElse("-from", "00:00")
val from = paramsMap.getOrElse("--from", "00:00")
val fromTime = LocalTime.parse(from)
val until = paramsMap.getOrElse("-until", "23:59")
val until = paramsMap.getOrElse("--until", "23:59")
val untilTime = LocalTime.parse(until)
val direction = paramsMap.getOrElse("-d", "")
val direction = paramsMap.getOrElse("--d", "")
Try(train.r) match {
case Success(_) =>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment