yesod-bin 1.2.3.3 → 1.2.3.4
raw patch · 3 files changed
+19/−2 lines, 3 files
Files
- Options.hs +11/−1
- main.hs +7/−0
- yesod-bin.cabal +1/−1
Options.hs view
@@ -71,7 +71,7 @@ in parseri { infoParser = injectDefaultP env (path ++ [normalizeName cmd]) (infoParser parseri) } in OptP (Option (CmdReader cmds (`M.lookup` cmdMap)) props) | (Option (OptReader names (CReader _ rdr) _) _) <- o =- p <|> either (const empty) pure (msum $ map (rdr <=< (maybe (Left $ ErrorMsg "Missing environment variable") Right . getEnvValue env path)) names)+ p <|> either' (const empty) pure (msum $ map (rdr <=< (maybe (left $ ErrorMsg "Missing environment variable") right . getEnvValue env path)) names) | (Option (FlagReader names a) _) <- o = p <|> if any ((==Just "1") . getEnvValue env path) names then pure a else empty | otherwise = p@@ -80,6 +80,16 @@ injectDefaultP env path (AltP p1 p2) = AltP (injectDefaultP env path p1) (injectDefaultP env path p2) injectDefaultP _env _path b@(BindP {}) = b++#if MIN_VERSION_optparse_applicative(0,6,0)+right = ReadM . Right+left = ReadM . Left+either' f g (ReadM x) = either f g x+#else+right = Right+left = Left+either' = either+#endif getEnvValue :: M.Map [String] String -> [String] -> OptName -> Maybe String getEnvValue env path (OptLong l) = M.lookup (path ++ [normalizeName l]) env
main.hs view
@@ -16,6 +16,9 @@ import Scaffolding.Scaffolder import Options.Applicative.Builder.Internal (Mod, OptionFields)+#if MIN_VERSION_optparse_applicative(0,6,0)+import Options.Applicative.Types (ReadM (ReadM))+#endif #ifndef WINDOWS import Build (touch)@@ -165,7 +168,11 @@ optStr m = nullOption $ value Nothing <> reader (success . str) <> m where+#if MIN_VERSION_optparse_applicative(0,6,0)+ success = ReadM . Right+#else success = Right+#endif -- | Like @rawSystem@, but exits if it receives a non-success result. rawSystem' :: String -> [String] -> IO ()
yesod-bin.cabal view
@@ -1,5 +1,5 @@ name: yesod-bin-version: 1.2.3.3+version: 1.2.3.4 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>