simple-cmd-args 0.1.1 → 0.1.2
raw patch · 3 files changed
+49/−10 lines, 3 files
Files
- CHANGELOG.md +5/−3
- SimpleCmdArgs.hs +40/−3
- simple-cmd-args.cabal +4/−4
CHANGELOG.md view
@@ -1,7 +1,11 @@ # Changelog -`simple-cmd-args` uses [PVP Versioning][1].+`simple-cmd-args` uses [PVP Versioning](https://pvp.haskell.org). +## 0.1.2+- add flagWith and flagWith'+- export Parser, auto, optional+ ## 0.1.1 - add switchWith, strOptionWith, optionWith, optionalWith, strOptionalWith, argumentWith@@ -12,5 +16,3 @@ ## 0.1.0 - Initial release with subcommands and option Mod functions--[1]: https://pvp.haskell.org
SimpleCmdArgs.hs view
@@ -14,6 +14,8 @@ subcommands, strArg, switchWith,+ flagWith,+ flagWith', switchMods, strOptionWith, optionWith,@@ -21,7 +23,10 @@ strOptionalWith, optionalWith, optionalMods,- argumentWith+ argumentWith,+ Parser,+ auto,+ optional ) where @@ -71,6 +76,8 @@ mods = fullDesc <> header h <> progDesc pd <> noIntersperse -- | Generic parser executor with explicit info modifiers+--+-- @since 0.1.1 simpleCmdArgsWithMods :: Maybe Version -- ^ version string -> InfoMod (IO ()) -- ^ modifiers@@ -103,10 +110,30 @@ -- | switch with Mods -- -- > switchWith 'o' "option" "help description"+--+-- @since 0.1.1 switchWith :: Char -> String -> String -> Parser Bool switchWith s l h = switch (switchMods s l h) +-- | flag with Mods+--+-- > flagWith offVal onVal 'f' "flag" "help description"+--+-- @since 0.1.2+flagWith :: a -> a -> Char -> String -> String -> Parser a+flagWith off on s l h =+ flag off on (switchMods s l h)++-- | flag' with Mods+--+-- > flagWith' val 'f' "flag" "help description"+--+-- @since 0.1.2+flagWith' :: a -> Char -> String -> String -> Parser a+flagWith' val s l h =+ flag' val (switchMods s l h)+ -- | @Mod@s for a switch. -- -- > switchMods 'o' "option" "help description"@@ -118,13 +145,17 @@ -- | strOption with Mods -- -- > strOptionWith 'o' "option" "METAVAR" "help description"+--+-- @since 0.1.1 strOptionWith :: Char -> String -> String -> String -> Parser String strOptionWith s l meta h = strOption (optionMods s l meta h) -- | option with Mods ----- > optionWith 'o' "option" "METAVAR" "help description"+-- > optionWith auto 'o' "option" "METAVAR" "help description"+--+-- @since 0.1.1 optionWith :: ReadM a -> Char -> String -> String -> String -> Parser a optionWith r s l meta h = option r (optionMods s l meta h)@@ -140,13 +171,17 @@ -- | strOptional with Mods -- -- > strOptionalWith 'o' "option" "METAVAR" "help description" default+--+-- @since 0.1.1 strOptionalWith :: Char -> String -> String -> String -> String -> Parser String strOptionalWith s l meta h d = strOption (optionalMods s l meta h d) -- | optional option with Mods, includes a default value. ----- > optionalWith 'o' "option" "METAVAR" "help description" default+-- > optionalWith auto 'o' "option" "METAVAR" "help description" default+--+-- @since 0.1.1 optionalWith :: ReadM a -> Char -> String -> String -> String -> a -> Parser a optionalWith r s l meta h d = option r (optionalMods s l meta h d)@@ -162,6 +197,8 @@ -- | argument with METAVAR -- -- > argumentWith auto "METAVAR"+--+-- @since 0.1.1 argumentWith :: ReadM a -> String -> Parser a argumentWith r meta = argument r (metavar meta)
simple-cmd-args.cabal view
@@ -1,12 +1,12 @@ cabal-version: 1.18 name: simple-cmd-args-version: 0.1.1+version: 0.1.2 synopsis: Simple command args parsing and execution description: This is a small wrapper over optparse-applicative which allows combining args parsers directly with IO commands. For subcommands this can avoid type boilerplate.- It also provides a few functions for common Mod combinations.+ It also provides some compact aliases for options with their Mod's. homepage: https://github.com/juhp/simple-cmd-args bug-reports: https://github.com/juhp/simple-cmd-args/issues license: BSD3@@ -19,7 +19,7 @@ extra-doc-files: README.md , CHANGELOG.md tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2,- GHC == 8.4.4, GHC == 8.6.4+ GHC == 8.4.4, GHC == 8.6.5 source-repository head type: git@@ -29,7 +29,7 @@ exposed-modules: SimpleCmdArgs build-depends: base >= 4 && < 5- , optparse-applicative+ , optparse-applicative >= 0.14.1 if impl(ghc<8.0) build-depends: semigroups