multiarg 0.30.0.0 → 0.30.0.2
raw patch · 5 files changed
+156/−123 lines, 5 filesdep ~QuickCheckdep ~barecheckdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: QuickCheck, barecheck, base, quickpull
API changes (from Hackage documentation)
Files
- README.md +28/−0
- lib/Multiarg/Vocabulary.hs +11/−12
- multiarg.cabal +109/−108
- tests/Decrees.hs +2/−2
- tests/Grover/Tests.hs +6/−1
README.md view
@@ -48,3 +48,31 @@ might help you diagnose any dependency issues. [](https://travis-ci.org/massysett/multiarg)++## Similar libraries++Of course there are many command-line parsing modules and libraries+out there; here are some comparisons.++[optparse-applicative](https://hackage.haskell.org/package/optparse-applicative):+very featureful with a well thought-out interface. Builds help for+you. I often use this if it meets my needs. From what I can tell,+though, it strips out information about the relative ordering of the+words from the command line; for instance, if the user typed "hello+--opt1 --opt2", you cannot tell whether she entered "--opt1" before+she entered "--opt2". Also, from what I can tell it cannot easily+parse options that take more than one argument.++[GetOpt](https://hackage.haskell.org/package/base-4.7.0.2/docs/System-Console-GetOpt.html):+comes with the base libraries, so you don't have to install anything+extra, which gives it a huge advantage. Keeps information about the+relative ordering of the words from the command line. Cannot easily+parse options that take more than one argument.++[cmdargs](https://hackage.haskell.org/package/cmdargs): after multiple+passes through the Haddocks I could never make any sense of this+library at all, which must be a reflection of my level of Haskell+ignorance.++More comparisons are at the [Haskell+Wiki](https://www.haskell.org/haskellwiki/Command_line_option_parsers).
lib/Multiarg/Vocabulary.hs view
@@ -8,18 +8,18 @@ -- shell is responsible for splitting the command line into -- /words/. Typically you separate /words/ with spaces, although -- quoting can affect this. multiarg parses lists of /words/. Each--- /word/ can consist of a single /long option/, a single /long--- option/ and an accompanying /option argument/, a single /short--- option/, multiple /short options/, and even one or more /short--- options/ with the last /short option/ being accompanied by an+-- /word/ can consist of a single /long option/, a single /long option/+-- and an accompanying /option argument/, a single /short option/,+-- multiple /short options/, and even one or more /short options/+-- with the last /short option/ being accompanied by an -- /option argument/. Or, a word can be a /positional argument/ or a -- /stopper/. All these are described below. -- -- [/option/] /Options/ allow a user to specify ways to tune the -- operation of a program. Typically /options/ are indeed optional, -- although some programs do sport \"required options\" (a bit of an--- oxymoron). /Options/ can be either /short options/ or /long--- options/. options. Also, /options/ can take /option arguments/.+-- oxymoron). /Options/ can be either /short options/ or /long options/.+-- Also, /options/ can take /option arguments/. -- The option is specified on the command line with both the /flag/ -- that specifies the option and of any /option arguments/ that are -- included with the /option/. Therefore the /option/ might be@@ -62,8 +62,7 @@ -- single letter. For example, @tail(1)@ has long options including -- @follow@ and @verbose@. The user would specify these on the command -- line by typing @tail --follow --verbose@. A long option is--- specified on the command line with a /flag/ and any /option--- arguments/.+-- specified on the command line with a /flag/ and any /option arguments/. -- -- [/option argument/] An /option/ may take anywhere from zero to -- three /option arguments/. When using a /short option/, the first@@ -81,10 +80,10 @@ -- appear in its own /word/. -- -- [/positional argument/] A /word/ on the command line that does not--- contain a /flag/, is not a /stopper/, and is not an /option--- argument/. For instance, with @tail(1)@, you specify the files you--- want to see by using /positional arguments/. In the command @tail -n--- 10 myfile@, @myfile@ is a /positional argument/.+-- contain a /flag/, is not a /stopper/, and is not an /option argument/.+-- For instance, with @tail(1)@, you specify the files you+-- want to see by using /positional arguments/. In the command @tail -n 10 myfile@,+-- @myfile@ is a /positional argument/. -- -- [/stopper/] A /word/ consisting solely of two hyphens, -- @--@. The user types this to indicate that all subsequent words
multiarg.cabal view
@@ -3,15 +3,16 @@ -- http://www.github.com/massysett/cartel -- -- Script name used to generate: genCabal.hs--- Generated on: 2014-12-22 12:47:53.73184 EST--- Cartel library version: 0.10.0.2+-- Generated on: 2015-02-19 07:37:09.506803 EST+-- Cartel library version: 0.14.2.0+ name: multiarg-version: 0.30.0.0+version: 0.30.0.2 cabal-version: >= 1.16-build-type: Simple license: BSD3 license-file: LICENSE-copyright: Copyright 2011-2014 Omari Norman+build-type: Simple+copyright: Copyright 2011-2015 Omari Norman author: Omari Norman maintainer: omari@smileystation.com stability: Experimental@@ -24,150 +25,150 @@ See the documentation in the Multiarg module for details. category: Console, Parsing extra-source-files:- ChangeLog- , README.md--source-repository head- type: git- location: git://github.com/massysett/multiarg.git--Flag programs- Description: Build test programs.- Default: False- Manual: True+ ChangeLog+ README.md Library hs-source-dirs:- lib+ lib ghc-options:- -Wall+ -Wall default-language: Haskell2010 build-depends:- base ((> 4.5.0.0 || == 4.5.0.0) && < 5)+ base >= 4.5.0.0 && < 5 exposed-modules:- Multiarg- , Multiarg.Examples- , Multiarg.Examples.Grover- , Multiarg.Examples.Telly- , Multiarg.Internal- , Multiarg.Limeline- , Multiarg.Maddash- , Multiarg.Mode- , Multiarg.Mode.Internal- , Multiarg.Types- , Multiarg.Util- , Multiarg.Vocabulary+ Multiarg+ Multiarg.Examples+ Multiarg.Examples.Grover+ Multiarg.Examples.Telly+ Multiarg.Internal+ Multiarg.Limeline+ Multiarg.Maddash+ Multiarg.Mode+ Multiarg.Mode.Internal+ Multiarg.Types+ Multiarg.Util+ Multiarg.Vocabulary +source-repository head+ type: git+ location: https://github.com/massysett/multiarg.git+ Executable grover main-is: grover-main.hs if flag(programs)+ buildable: True hs-source-dirs:- lib+ lib ghc-options:- -Wall+ -Wall default-language: Haskell2010 build-depends:- base ((> 4.5.0.0 || == 4.5.0.0) && < 5)+ base >= 4.5.0.0 && < 5 build-depends:- QuickCheck ((> 2.6 || == 2.6) && < 2.8)- , quickpull ((> 0.4.0.0 || == 0.4.0.0) && < 0.5)- , barecheck ((> 0.2.0.6 || == 0.2.0.6) && < 0.3)- buildable: True+ QuickCheck >= 2.7 && < 2.8+ , quickpull >= 0.4.0.0 && < 0.5+ , barecheck >= 0.2.0.6 && < 0.3 other-modules:- Multiarg- , Multiarg.Examples- , Multiarg.Examples.Grover- , Multiarg.Examples.Telly- , Multiarg.Internal- , Multiarg.Limeline- , Multiarg.Maddash- , Multiarg.Mode- , Multiarg.Mode.Internal- , Multiarg.Types- , Multiarg.Util- , Multiarg.Vocabulary- , Decrees- , Ernie- , Grover.Tests- , Makeopt- , Multiarg.Maddash.Tests- , Telly.Tests+ Multiarg+ Multiarg.Examples+ Multiarg.Examples.Grover+ Multiarg.Examples.Telly+ Multiarg.Internal+ Multiarg.Limeline+ Multiarg.Maddash+ Multiarg.Mode+ Multiarg.Mode.Internal+ Multiarg.Types+ Multiarg.Util+ Multiarg.Vocabulary+ Decrees+ Ernie+ Grover.Tests+ Makeopt+ Multiarg.Maddash.Tests+ Telly.Tests hs-source-dirs:- tests+ tests else buildable: False Executable telly main-is: telly-main.hs if flag(programs)+ buildable: True hs-source-dirs:- lib+ lib ghc-options:- -Wall+ -Wall default-language: Haskell2010 build-depends:- base ((> 4.5.0.0 || == 4.5.0.0) && < 5)+ base >= 4.5.0.0 && < 5 build-depends:- QuickCheck ((> 2.6 || == 2.6) && < 2.8)- , quickpull ((> 0.4.0.0 || == 0.4.0.0) && < 0.5)- , barecheck ((> 0.2.0.6 || == 0.2.0.6) && < 0.3)- buildable: True+ QuickCheck >= 2.7 && < 2.8+ , quickpull >= 0.4.0.0 && < 0.5+ , barecheck >= 0.2.0.6 && < 0.3 other-modules:- Multiarg- , Multiarg.Examples- , Multiarg.Examples.Grover- , Multiarg.Examples.Telly- , Multiarg.Internal- , Multiarg.Limeline- , Multiarg.Maddash- , Multiarg.Mode- , Multiarg.Mode.Internal- , Multiarg.Types- , Multiarg.Util- , Multiarg.Vocabulary- , Decrees- , Ernie- , Grover.Tests- , Makeopt- , Multiarg.Maddash.Tests- , Telly.Tests+ Multiarg+ Multiarg.Examples+ Multiarg.Examples.Grover+ Multiarg.Examples.Telly+ Multiarg.Internal+ Multiarg.Limeline+ Multiarg.Maddash+ Multiarg.Mode+ Multiarg.Mode.Internal+ Multiarg.Types+ Multiarg.Util+ Multiarg.Vocabulary+ Decrees+ Ernie+ Grover.Tests+ Makeopt+ Multiarg.Maddash.Tests+ Telly.Tests hs-source-dirs:- tests+ tests else buildable: False Test-Suite multiarg-tests hs-source-dirs:- lib+ lib ghc-options:- -Wall+ -Wall default-language: Haskell2010 build-depends:- base ((> 4.5.0.0 || == 4.5.0.0) && < 5)+ base >= 4.5.0.0 && < 5 type: exitcode-stdio-1.0 main-is: multiarg-tests.hs other-modules:- Multiarg- , Multiarg.Examples- , Multiarg.Examples.Grover- , Multiarg.Examples.Telly- , Multiarg.Internal- , Multiarg.Limeline- , Multiarg.Maddash- , Multiarg.Mode- , Multiarg.Mode.Internal- , Multiarg.Types- , Multiarg.Util- , Multiarg.Vocabulary- , Decrees- , Ernie- , Grover.Tests- , Makeopt- , Multiarg.Maddash.Tests- , Telly.Tests+ Multiarg+ Multiarg.Examples+ Multiarg.Examples.Grover+ Multiarg.Examples.Telly+ Multiarg.Internal+ Multiarg.Limeline+ Multiarg.Maddash+ Multiarg.Mode+ Multiarg.Mode.Internal+ Multiarg.Types+ Multiarg.Util+ Multiarg.Vocabulary+ Decrees+ Ernie+ Grover.Tests+ Makeopt+ Multiarg.Maddash.Tests+ Telly.Tests hs-source-dirs:- tests+ tests build-depends:- QuickCheck ((> 2.6 || == 2.6) && < 2.8)- , quickpull ((> 0.4.0.0 || == 0.4.0.0) && < 0.5)- , barecheck ((> 0.2.0.6 || == 0.2.0.6) && < 0.3)+ QuickCheck >= 2.7 && < 2.8+ , quickpull >= 0.4.0.0 && < 0.5+ , barecheck >= 0.2.0.6 && < 0.3++Flag programs+ description: Build sample programs+ default: False+ manual: True
tests/Decrees.hs view
@@ -12,8 +12,8 @@ decrees :: [Decree] decrees = - [ Decree ( Meta {modDesc = ModDesc {modPath = "tests/Grover/Tests.hs", modName = ["Grover","Tests"]}, linenum = 118, qName = "prop_ValidGrover"} ) ( Single Grover.Tests.prop_ValidGrover )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Grover/Tests.hs", modName = ["Grover","Tests"]}, linenum = 124, qName = "prop_alwaysTrue"} ) ( Single Grover.Tests.prop_alwaysTrue )+ [ Decree ( Meta {modDesc = ModDesc {modPath = "tests/Grover/Tests.hs", modName = ["Grover","Tests"]}, linenum = 123, qName = "prop_ValidGrover"} ) ( Single Grover.Tests.prop_ValidGrover )+ , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Grover/Tests.hs", modName = ["Grover","Tests"]}, linenum = 129, qName = "prop_alwaysTrue"} ) ( Single Grover.Tests.prop_alwaysTrue ) , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Multiarg/Maddash/Tests.hs", modName = ["Multiarg","Maddash","Tests"]}, linenum = 119, qName = "prop_nonOptWordNotAnOptionIfStateIsReady"} ) ( Single Multiarg.Maddash.Tests.prop_nonOptWordNotAnOptionIfStateIsReady ) , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Multiarg/Maddash/Tests.hs", modName = ["Multiarg","Maddash","Tests"]}, linenum = 128, qName = "prop_stopperNotAnOptionIfStateIsReady"} ) ( Single Multiarg.Maddash.Tests.prop_stopperNotAnOptionIfStateIsReady ) , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Multiarg/Maddash/Tests.hs", modName = ["Multiarg","Maddash","Tests"]}, linenum = 136, qName = "prop_singleDashNotAnOptionIfStateIsReady"} ) ( Single Multiarg.Maddash.Tests.prop_singleDashNotAnOptionIfStateIsReady )
tests/Grover/Tests.hs view
@@ -94,7 +94,12 @@ nonEmpty = (:) <$> firstWord <*> listOf arbitrary where firstWord = arbitrary `suchThat`- (\s -> not (s `elem` ["int", "string", "maybe"]))+ (\s -> not (s `elem` ["int", "string", "maybe"])+ && not (startsWithHyphen s))+ startsWithHyphen s = case s of+ '-':_ -> True+ _ -> False+ resultAndStrings :: (Arbitrary a, Show a)