werewolf 1.2.0.2 → 1.2.0.3
raw patch · 3 files changed
+23/−16 lines, 3 filesdep ~template-haskelldep ~transformers
Dependency ranges changed: template-haskell, transformers
Files
- CHANGELOG.md +7/−0
- app/Werewolf/Command/Help.hs +12/−12
- werewolf.cabal +4/−4
CHANGELOG.md view
@@ -7,6 +7,13 @@ ### Upcoming +### v1.2.0.3++*Revisions*++* Fixed help subcommands from causing an error when a game doesn't exist. ([#230](https://github.com/hjwylde/werewolf/issues/230))+* Fixed help subcommands for no-role-knowledge variant. ([#232](https://github.com/hjwylde/werewolf/issues/232))+ ### v1.2.0.2 *Revisions*
app/Werewolf/Command/Help.hs view
@@ -18,6 +18,7 @@ ) where import Control.Lens+import Control.Monad.Extra import Control.Monad.IO.Class import Data.Function@@ -51,20 +52,24 @@ { messages = commandsMessages callerName mGame } handle callerName tag (Options (Just (Roles optAll))) = do- mGame <- getGame tag optAll+ mGame <- getGame tag optAll+ let mGame' = mGame >>= \game -> case game ^. variant of+ NoRoleKnowledge -> Nothing+ _ -> Just game - let roles' = sortBy (compare `on` humanise) . nub $ case mGame of- Just game -> game ^.. players . roles- Nothing -> allRoles+ let roles' = sortBy (compare `on` humanise) . nub $ maybe allRoles (toListOf $ players . roles) mGame' exitWith success { messages = map (roleMessage callerName) roles' } handle callerName tag (Options (Just (Rules optAll))) = do- mGame <- getGame tag optAll+ mGame <- getGame tag optAll+ let mGame' = mGame >>= \game -> case game ^. variant of+ NoRoleKnowledge -> Nothing+ _ -> Just game exitWith success- { messages = rulesMessages callerName mGame+ { messages = rulesMessages callerName mGame' } handle callerName _ (Options Nothing) = exitWith success { messages = helpMessages callerName@@ -105,9 +110,4 @@ getGame :: MonadIO m => Text -> Bool -> m (Maybe Game) getGame _ True = return Nothing-getGame tag _ = do- game <- readGame tag-- return $ case game ^. variant of- NoRoleKnowledge -> Nothing- _ -> Just game+getGame tag _ = ifM (doesGameExist tag) (Just <$> readGame tag) (return Nothing)
werewolf.cabal view
@@ -1,5 +1,5 @@ name: werewolf-version: 1.2.0.2+version: 1.2.0.3 author: Henry J. Wylde maintainer: public@hjwylde.com@@ -286,7 +286,7 @@ optparse-applicative >= 0.11 && < 0.13, random-shuffle, text == 1.2.*,- transformers == 0.4.*,+ transformers >= 0.4 && < 0.6, werewolf library@@ -318,6 +318,6 @@ interpolate == 0.1.*, lens >= 4.12 && < 4.15, mtl == 2.2.*,- template-haskell == 2.10.*,+ template-haskell >= 2.10 && < 2.12, text == 1.2.*,- transformers == 0.4.*+ transformers >= 0.4 && < 0.6