summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2019-03-28 07:24:17 +0300
committerdefanor <defanor@uberspace.net>2019-03-28 07:24:17 +0300
commit62586fc58a06c025419f912bf31532283b022104 (patch)
treed79ef93ad505c606f984b455c8419363bc2b333c
parent0165caef2f5651231ef3cd216192f8a3a7a99b39 (diff)
Shorten commands
-rw-r--r--DWProxy.hs21
-rw-r--r--README.md6
2 files changed, 13 insertions, 14 deletions
diff --git a/DWProxy.hs b/DWProxy.hs
index a8d4acd..5ff3cf7 100644
--- a/DWProxy.hs
+++ b/DWProxy.hs
@@ -275,19 +275,18 @@ data Config = Config { cClient :: Socket
}
pRouteChoice :: Parser Command
-pRouteChoice = do
- _ <- "route "
- d <- decimal
- _ <- "\r\n"
- pure $ RouteChoice d
+pRouteChoice = RouteChoice <$> decimal <* "\r\n"
pSpeedWalk :: Parser Command
-pSpeedWalk = do
- _ <- "speedwalk "
- from <- ("from " *> (Just <$> manyTill (notChar '\255') " to "))
- <|> ("to " *> pure Nothing)
- to <- manyTill (notChar '\255') "\r\n"
- pure $ SpeedWalk from to
+pSpeedWalk = full <|> short
+ where
+ short = "sw " *> (SpeedWalk Nothing <$> manyTill (notChar '\255') "\r\n")
+ full = do
+ _ <- "speedwalk "
+ from <- ("from " *> (Just <$> manyTill (notChar '\255') " to "))
+ <|> ("to " *> pure Nothing)
+ to <- manyTill (notChar '\255') "\r\n"
+ pure $ SpeedWalk from to
pShopSearch :: Parser Command
pShopSearch = ShopSearch <$> ("shop " *> manyTill (notChar '\255') "\r\n")
diff --git a/README.md b/README.md
index b4ace02..534feb8 100644
--- a/README.md
+++ b/README.md
@@ -3,9 +3,9 @@
This is a client-agnostic proxy for the Discworld MUD, which adds new
commands:
-- `speedwalk [from <location>] to <location>`: find routes, walk if
- there's only one
-- `route <n>`: select a speedwalk route option
+- `speedwalk [from <location>] to <location>` or `sw <destination>`:
+ find routes, walk if there's only one
+- `<number>`: select a speedwalk route option
- `shop <item>`: search shops by items they sell
It uses the database from [Quow's Cow Bar and