Hello community, here is the log from the commit of package ghc-cmdargs for openSUSE:Factory checked in at 2018-05-30 12:04:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-cmdargs (Old) and /work/SRC/openSUSE:Factory/.ghc-cmdargs.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-cmdargs" Wed May 30 12:04:19 2018 rev:7 rq:607767 version:0.10.20 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-cmdargs/ghc-cmdargs.changes 2017-09-15 21:27:21.320137426 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-cmdargs.new/ghc-cmdargs.changes 2018-05-30 12:25:09.450619175 +0200 @@ -1,0 +2,8 @@ +Mon May 14 17:02:11 UTC 2018 - [email protected] + +- Update cmdargs to version 0.10.20. + #54, use the getopt data types from base + #47, ensure Semigroup instance on all GHC versions + #47, GHC 8.4 compatibility + +------------------------------------------------------------------- Old: ---- cmdargs-0.10.17.tar.gz New: ---- cmdargs-0.10.20.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-cmdargs.spec ++++++ --- /var/tmp/diff_new_pack.QETLpZ/_old 2018-05-30 12:25:10.182595351 +0200 +++ /var/tmp/diff_new_pack.QETLpZ/_new 2018-05-30 12:25:10.186595221 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-cmdargs # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %global pkg_name cmdargs Name: ghc-%{pkg_name} -Version: 0.10.17 +Version: 0.10.20 Release: 0 Summary: Command line argument processing License: BSD-3-Clause @@ -79,7 +79,7 @@ %ghc_pkg_recache %files -f %{name}.files -%doc LICENSE +%license LICENSE %files devel -f %{name}-devel.files %doc CHANGES.txt README.md ++++++ cmdargs-0.10.17.tar.gz -> cmdargs-0.10.20.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmdargs-0.10.17/CHANGES.txt new/cmdargs-0.10.20/CHANGES.txt --- old/cmdargs-0.10.17/CHANGES.txt 2017-03-31 21:30:36.000000000 +0200 +++ new/cmdargs-0.10.20/CHANGES.txt 2018-01-22 19:47:01.000000000 +0100 @@ -1,71 +1,77 @@ Changelog for CmdArgs -0.10.17 +0.10.20, released 2018-01-22 + #54, use the getopt data types from base +0.10.19, released 2018-01-01 + #47, ensure Semigroup instance on all GHC versions +0.10.18, released 2017-09-24 + #47, GHC 8.4 compatibility +0.10.17, released 2017-03-31 Add processValueIO for more controlled error messages #529, don't include the stack trace in processValue -0.10.16 +0.10.16, released 2017-03-22 Minor improvement to error messages -0.10.15 +0.10.15, released 2017-03-06 #43, GHC 8.2 compatibility -0.10.14 +0.10.14, released 2016-02-16 #39, ensure correct line breaks in HTML help output #18, preserve manual \n in help messages #25, reformat the README -0.10.13 +0.10.13, released 2015-05-22 #24, support Ratio in some places -0.10.12 +0.10.12, released 2014-10-27 GHC 7.2 compatibility -0.10.11 +0.10.11, released 2014-10-12 #15, never put [brackets] around optional args in Explicit -0.10.10 +0.10.10, released 2014-09-18 #14, fix @ file arguments -0.10.9 +0.10.9, released 2014-07-22 #10, fix versionArgs (broken in 0.10.8) -0.10.8 +0.10.8, released 2014-07-21 Avoid compilation warnings on GHC 7.8 #9, add --numeric-version flag Update the copyright year Change GetOpt.usageInfo to be more like GetOpt -0.10.7 +0.10.7, released 2013-12-09 #1, fix timestamps in .tar.gz dist file -0.10.6 +0.10.6, released 2013-12-05 #625, more documentation about args/argPos #626, ensure initial lists don't get reversed (fix after #610) -0.10.5 +0.10.5, released 2013-07-29 #615, support lists inside a newtype -0.10.4 +0.10.4, released 2013-06-26 #610, make sure it is O(n) to append arguments, not O(n^2) -0.10.3 +0.10.3, released 2013-04-05 Append list items under an enum Support &= ignore on enum fields -0.10.2 +0.10.2, released 2013-02-28 Relax upper bounds to be GHC 7.7 compatible -0.10.1 +0.10.1, released 2012-11-17 #569, set the test program to off by default Complete revamp of cmdargs-browser, far better Javascript Add a missing case for Helper marshalling FlagNone -0.10 +0.10, released 2012-08-09 Revert to 0.9.6, including modeExpandAt -0.9.7 +0.9.7, released 2012-08-09 Revert to 0.9.5, to fix up PVP breakage -0.9.6 +0.9.6, released 2012-07-29 #539, hopefully more fixes to compiling in profile mode #522, add modeExpandAt and noAtExpand annotation #522, don't @expand after -- -0.9.5 +0.9.5, released 2012-03-25 Don't specify TH extension unless quotation is true -0.9.4 +0.9.4, released 2012-03-25 #539, specify the TH extension in the Cabal file Allow transformers 0.3.* Correct copyright in license and cabal file -0.9.3 +0.9.3, released 2012-02-10 Add expandArgsAt and support for @ flag file directives -0.9.2 +0.9.2, released 2012-01-07 Don't build the test program if quotation is turned off -0.9.1 +0.9.1, released 2012-01-05 Improve the documentation for the Explicit module #433, propagate groupname on modes in the Implicit code -0.9 +0.9, released 2011-11-05 #467, add completions for people running bash #334, add a Quote module, to write pure in the impure syntax #482, fix the sample in Explicit, don't use def @@ -73,59 +79,59 @@ Make showHelp take an argument for the prefix bits Add Helper interface, and initial cmdargs-browser code Add splitArgs/joinArgs -0.8 +0.8, released 2011-08-13 #450, redo the manual generator so Maker example is not cut off Support all the types in Data.Int/Data.Word Make modeArgs take a list of arguments as well -0.7 +0.7, released 2011-05-07 No changes, just a version bump to allow requiring the GHC fix -0.6.10 +0.6.10, released 2011-05-07 Change the annotate module to cope better with GHC's CSE -0.6.9 +0.6.9, released 2011-04-03 #422, support newtype value as the underlying type -0.6.8 +0.6.8, released 2011-02-13 Allow versionArgs [summary] to override --version Improve the documentation surrounding opt Add modeReform to Mode Add modeEmpty, to construct blank Mode values Improve the documentation surrounding pure annotations. -0.6.7 +0.6.7, released 2011-01-15 #395, don't put two newlines after --help or --version -0.6.6 +0.6.6, released 2010-12-30 #392, support helpArgs [groupname "something"] -0.6.5 +0.6.5, released 2010-12-15 Don't fail with ambiguous enum if you exactly match a value Put errors on stderr -0.6.4 +0.6.4, released 2010-11-20 Eliminate the filepath dependence -0.6.3 +0.6.3, released 2010-11-10 Switch mtl for transformers -0.6.2 +0.6.2, released 2010-11-10 Build on GHC 7.0 RC2, add an extra type signature Add verbosityArgs to customise the verbose/quiet flags Add helpArg/versionArg flags to customise those flags Support multiline summary using \n escape codes -0.6.1 +0.6.1, released 2010-10-04 Build on GHC 6.10, don't rely on record name disambiguation -0.6 +0.6, released 2010-09-18 Add ignore annotation for modes and flags #350, make top-level help appear properly -0.5 +0.5, released 2010-09-15 #351, name/explicit attributes on mode were broken (regression) -0.4 +0.4, released 2010-09-05 #342, display common fields only once Raise errors if annotations are placed in invalid places Rewrite the translation of annotation to explicit modes Treat anything after -- as an argument Add a pure annotation mechanism Introduce System.Console.CmdArgs.Annotate -0.3 +0.3, released 2010-08-23 Add a documentation example for the Explicit mode Improve the purity and annotations a bit, try disabling CSE Change the help format Rename groupHiden to groupHidden, patch from Matthew Cox Bug, missing fields and explicit enums didn't work together -0.2 +0.2, released 2010-08-14 #252, add support for grouped flags/modes #333, support missing fields Add support for reading tuple values (including nested) @@ -137,5 +143,5 @@ #231, add support for Maybe #256, add --option=false support Complete rewrite to introduce Explicit module -0.1.1 +0.1, released 2009-09-12 Start of changelog diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmdargs-0.10.17/Data/Generics/Any/Prelude.hs new/cmdargs-0.10.20/Data/Generics/Any/Prelude.hs --- old/cmdargs-0.10.17/Data/Generics/Any/Prelude.hs 2017-03-31 21:30:36.000000000 +0200 +++ new/cmdargs-0.10.20/Data/Generics/Any/Prelude.hs 2018-01-22 19:47:01.000000000 +0100 @@ -2,7 +2,6 @@ module Data.Generics.Any.Prelude where -import Prelude hiding (head,tail,null) import Data.Generics.Any import Data.Maybe diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmdargs-0.10.17/Data/Generics/Any.hs new/cmdargs-0.10.20/Data/Generics/Any.hs --- old/cmdargs-0.10.17/Data/Generics/Any.hs 2017-03-31 21:30:36.000000000 +0200 +++ new/cmdargs-0.10.20/Data/Generics/Any.hs 2018-01-22 19:47:01.000000000 +0100 @@ -5,7 +5,7 @@ import Control.Exception import Control.Monad.Trans.State import qualified Data.Data as D -import Data.Data hiding (toConstr, typeOf, dataTypeOf, isAlgType) +import Data.Data hiding (toConstr, typeOf, dataTypeOf) import Data.List import Data.Maybe import System.IO.Unsafe diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmdargs-0.10.17/LICENSE new/cmdargs-0.10.20/LICENSE --- old/cmdargs-0.10.17/LICENSE 2017-03-31 21:30:36.000000000 +0200 +++ new/cmdargs-0.10.20/LICENSE 2018-01-22 19:47:01.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright Neil Mitchell 2009-2017. +Copyright Neil Mitchell 2009-2018. All rights reserved. Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmdargs-0.10.17/README.md new/cmdargs-0.10.20/README.md --- old/cmdargs-0.10.17/README.md 2017-03-31 21:30:36.000000000 +0200 +++ new/cmdargs-0.10.20/README.md 2018-01-22 19:47:01.000000000 +0100 @@ -6,24 +6,24 @@ * It supports programs with multiple modes, such as [darcs](http://darcs.net) or [Cabal](http://haskell.org/cabal/). A very simple example of a command line processor is: +```haskell +data Sample = Sample {hello :: String} deriving (Show, Data, Typeable) - data Sample = Sample {hello :: String} deriving (Show, Data, Typeable) - - sample = Sample{hello = def &= help "World argument" &= opt "world"} - &= summary "Sample v1" - - main = print =<< cmdArgs sample +sample = Sample{hello = def &= help "World argument" &= opt "world"} + &= summary "Sample v1" +main = print =<< cmdArgs sample +``` Despite being very concise, this processor is already fairly well featured: $ runhaskell Sample.hs --hello=world Sample {hello = "world"} - + $ runhaskell Sample.hs --help Sample v1, (C) Neil Mitchell 2009 - + sample [FLAG] - + -? --help[=FORMAT] Show usage information (optional format) -V --version Show version information -v --verbose Higher verbosity @@ -46,19 +46,19 @@ ## Hello World Example The following code defines a complete command line argument processor: +```haskell +{-# LANGUAGE DeriveDataTypeable #-} +{-# OPTIONS_GHC -fno-cse #-} +module Sample where +import System.Console.CmdArgs - {-# LANGUAGE DeriveDataTypeable #-} - {-# OPTIONS_GHC -fno-cse #-} - module Sample where - import System.Console.CmdArgs - - data Sample = Sample {hello :: String} - deriving (Show, Data, Typeable) - - sample = Sample{hello = def} - - main = print =<< cmdArgs sample +data Sample = Sample {hello :: String} + deriving (Show, Data, Typeable) +sample = Sample{hello = def} + +main = print =<< cmdArgs sample +``` To use the CmdArgs library there are three steps: * Define a record data type (`Sample`) that contains a field for each argument. This type needs to have instances for `Show`, `Data` and `Typeable`. @@ -69,15 +69,15 @@ $ runhaskell Sample.hs --hello=world Sample {hello = "world"} - + $ runhaskell Sample.hs --version The sample program - + $ runhaskell Sample.hs --help The sample program - + sample [OPTIONS] - + -? --help Display help message -V --version Print version information -h --hello=ITEM @@ -87,13 +87,13 @@ ## Specifying Attributes In order to control the behaviour we can add attributes. For example to add an attribute specifying the help text for the `--hello` argument we can write: - - sample = Sample{hello = def &= help "Who to say hello to"} - +```haskell +sample = Sample{hello = def &= help "Who to say hello to"} +``` We can add additional attributes, for example to specify the type of the value expected by hello: - - sample = Sample {hello = def &= help "Who to say hello to" &= typ "WORLD"} - +```haskell +sample = Sample {hello = def &= help "Who to say hello to" &= typ "WORLD"} +``` Now when running `--help` the final line is: -h --hello=WORLD Who to say hello to @@ -104,37 +104,37 @@ ## Multiple Modes To specify a program with multiple modes, similar to [darcs](http://darcs.net/), we can supply a data type with multiple constructors, for example: - - data Sample = Hello {whom :: String} - | Goodbye - deriving (Show, Data, Typeable) - - hello = Hello{whom = def} - goodbye = Goodbye - - main = print =<< cmdArgs (modes [hello,goodbye]) +```haskell +data Sample = Hello {whom :: String} + | Goodbye + deriving (Show, Data, Typeable) + +hello = Hello{whom = def} +goodbye = Goodbye +main = print =<< cmdArgs (modes [hello,goodbye]) +``` Compared to the first example, we now have multiple constructors, and a sample value for each constructor is passed to `cmdArgs`. Some sample interactions with this command line are: $ runhaskell Sample.hs hello --whom=world Hello {whom = "world"} - + $ runhaskell Sample.hs goodbye Goodbye - + $ runhaskell Sample.hs --help The sample program - + sample [OPTIONS] - + Common flags -? --help Display help message -V --version Print version information - + sample hello [OPTIONS] - + -w --whom=ITEM - + sample goodbye [OPTIONS] As before, the behaviour can be customised using attributes. @@ -154,62 +154,62 @@ * The `cpp_define` field has an underscore in it's name, which is transformed into a hyphen for the flag name. The code is: +```haskell +{-# LANGUAGE DeriveDataTypeable #-} +module HLint where +import System.Console.CmdArgs + +data HLint = HLint + {report :: [FilePath] + ,hint :: [FilePath] + ,color :: Bool + ,ignore_ :: [String] + ,show_ :: Bool + ,extension :: [String] + ,language :: [String] + ,utf8 :: Bool + ,encoding :: String + ,find :: [FilePath] + ,test_ :: Bool + ,datadir :: [FilePath] + ,cpp_define :: [String] + ,cpp_include :: [FilePath] + ,files :: [FilePath] + } + deriving (Data,Typeable,Show,Eq) + +hlint = HLint + {report = def &= opt "report.html" &= typFile &= help "Generate a report in HTML" + ,hint = def &= typFile &= help "Hint/ignore file to use" + ,color = def &= name "c" &= name "colour" &= help "Color the output (requires ANSI terminal)" + ,ignore_ = def &= typ "MESSAGE" &= help "Ignore a particular hint" + ,show_ = def &= help "Show all ignored ideas" + ,extension = def &= typ "EXT" &= help "File extensions to search (defaults to hs and lhs)" + ,language = def &= name "X" &= typ "LANG" &= help "Language extension (Arrows, NoCPP)" + ,utf8 = def &= help "Use UTF-8 text encoding" + ,encoding = def &= typ "ENC" &= help "Choose the text encoding" + ,find = def &= typFile &= help "Find hints in a Haskell file" + ,test_ = def &= help "Run in test mode" + ,datadir = def &= typDir &= help "Override the data directory" + ,cpp_define = def &= typ "NAME[=VALUE]" &= help "CPP #define" + ,cpp_include = def &= typDir &= help "CPP include path" + ,files = def &= args &= typ "FILES/DIRS" + } &= + verbosity &= + help "Suggest improvements to Haskell source code" &= + summary "HLint v0.0.0, (C) Neil Mitchell" &= + details ["Hlint gives hints on how to improve Haskell code","" + ,"To check all Haskell files in 'src' and generate a report type:"," hlint src --report"] - {-# LANGUAGE DeriveDataTypeable #-} - module HLint where - import System.Console.CmdArgs - - data HLint = HLint - {report :: [FilePath] - ,hint :: [FilePath] - ,color :: Bool - ,ignore_ :: [String] - ,show_ :: Bool - ,extension :: [String] - ,language :: [String] - ,utf8 :: Bool - ,encoding :: String - ,find :: [FilePath] - ,test_ :: Bool - ,datadir :: [FilePath] - ,cpp_define :: [String] - ,cpp_include :: [FilePath] - ,files :: [FilePath] - } - deriving (Data,Typeable,Show,Eq) - - hlint = HLint - {report = def &= opt "report.html" &= typFile &= help "Generate a report in HTML" - ,hint = def &= typFile &= help "Hint/ignore file to use" - ,color = def &= name "c" &= name "colour" &= help "Color the output (requires ANSI terminal)" - ,ignore_ = def &= typ "MESSAGE" &= help "Ignore a particular hint" - ,show_ = def &= help "Show all ignored ideas" - ,extension = def &= typ "EXT" &= help "File extensions to search (defaults to hs and lhs)" - ,language = def &= name "X" &= typ "LANG" &= help "Language extension (Arrows, NoCPP)" - ,utf8 = def &= help "Use UTF-8 text encoding" - ,encoding = def &= typ "ENC" &= help "Choose the text encoding" - ,find = def &= typFile &= help "Find hints in a Haskell file" - ,test_ = def &= help "Run in test mode" - ,datadir = def &= typDir &= help "Override the data directory" - ,cpp_define = def &= typ "NAME[=VALUE]" &= help "CPP #define" - ,cpp_include = def &= typDir &= help "CPP include path" - ,files = def &= args &= typ "FILES/DIRS" - } &= - verbosity &= - help "Suggest improvements to Haskell source code" &= - summary "HLint v0.0.0, (C) Neil Mitchell" &= - details ["Hlint gives hints on how to improve Haskell code","" - ,"To check all Haskell files in 'src' and generate a report type:"," hlint src --report"] - - mode = cmdArgsMode hlint - +mode = cmdArgsMode hlint +``` Produces the `--help` output: HLint v0.0.0, (C) Neil Mitchell - + hlint [OPTIONS] [FILES/DIRS] Suggest improvements to Haskell source code - + Common flags: -r --report[=FILE] Generate a report in HTML -h --hint=FILE Hint/ignore file to use @@ -229,12 +229,12 @@ -V --version Print version information -v --verbose Loud verbosity -q --quiet Quiet verbosity - + Hlint gives hints on how to improve Haskell code - + To check all Haskell files in 'src' and generate a report type: hlint src --report - + ### Diffy @@ -245,47 +245,47 @@ * Default values are given for the `out` field, which are different in both modes. The code is: +```haskell +{-# LANGUAGE DeriveDataTypeable #-} +module Diffy where +import System.Console.CmdArgs + +data Diffy = Create {src :: Maybe FilePath, out :: FilePath} + | Diff {old :: FilePath, new :: FilePath, out :: FilePath} + deriving (Data,Typeable,Show,Eq) + +outFlags x = x &= help "Output file" &= typFile + +create = Create + {src = def &= help "Source directory" &= typDir + ,out = outFlags "ls.txt" + } &= help "Create a fingerprint" + +diff = Diff + {old = def &= typ "OLDFILE" &= argPos 0 + ,new = def &= typ "NEWFILE" &= argPos 1 + ,out = outFlags "diff.txt" + } &= help "Perform a diff" - {-# LANGUAGE DeriveDataTypeable #-} - module Diffy where - import System.Console.CmdArgs - - data Diffy = Create {src :: Maybe FilePath, out :: FilePath} - | Diff {old :: FilePath, new :: FilePath, out :: FilePath} - deriving (Data,Typeable,Show,Eq) - - outFlags x = x &= help "Output file" &= typFile - - create = Create - {src = def &= help "Source directory" &= typDir - ,out = outFlags "ls.txt" - } &= help "Create a fingerprint" - - diff = Diff - {old = def &= typ "OLDFILE" &= argPos 0 - ,new = def &= typ "NEWFILE" &= argPos 1 - ,out = outFlags "diff.txt" - } &= help "Perform a diff" - - mode = cmdArgsMode $ modes [create,diff] &= help "Create and compare differences" &= program "diffy" &= summary "Diffy v1.0" - +mode = cmdArgsMode $ modes [create,diff] &= help "Create and compare differences" &= program "diffy" &= summary "Diffy v1.0" +``` And `--help` produces: Diffy v1.0 - + diffy [COMMAND] ... [OPTIONS] Create and compare differences - + Common flags: -o --out=FILE Output file -? --help Display help message -V --version Print version information - + diffy create [OPTIONS] Create a fingerprint - + -s --src=DIR Source directory - + diffy diff [OPTIONS] OLDFILE NEWFILE Perform a diff @@ -298,67 +298,67 @@ * The `threads` field is in two of the constructors, but not all three. It is given the short flag `-j`, rather than the default `-t`. The code is: - - {-# LANGUAGE DeriveDataTypeable #-} - module Maker where - import System.Console.CmdArgs - - data Method = Debug | Release | Profile - deriving (Data,Typeable,Show,Eq) - - data Maker - = Wipe - | Test {threads :: Int, extra :: [String]} - | Build {threads :: Int, method :: Method, files :: [FilePath]} - deriving (Data,Typeable,Show,Eq) - - threadsMsg x = x &= help "Number of threads to use" &= name "j" &= typ "NUM" - - wipe = Wipe &= help "Clean all build objects" - - test_ = Test - {threads = threadsMsg def - ,extra = def &= typ "ANY" &= args - } &= help "Run the test suite" - - build = Build - {threads = threadsMsg def - ,method = enum - [Release &= help "Release build" - ,Debug &= help "Debug build" - ,Profile &= help "Profile build"] - ,files = def &= args - } &= help "Build the project" &= auto - - mode = cmdArgsMode $ modes [build,wipe,test_] - &= help "Build helper program" - &= program "maker" - &= summary "Maker v1.0\nMake it" - +```haskell +{-# LANGUAGE DeriveDataTypeable #-} +module Maker where +import System.Console.CmdArgs + +data Method = Debug | Release | Profile + deriving (Data,Typeable,Show,Eq) + +data Maker + = Wipe + | Test {threads :: Int, extra :: [String]} + | Build {threads :: Int, method :: Method, files :: [FilePath]} + deriving (Data,Typeable,Show,Eq) + +threadsMsg x = x &= help "Number of threads to use" &= name "j" &= typ "NUM" + +wipe = Wipe &= help "Clean all build objects" + +test_ = Test + {threads = threadsMsg def + ,extra = def &= typ "ANY" &= args + } &= help "Run the test suite" + +build = Build + {threads = threadsMsg def + ,method = enum + [Release &= help "Release build" + ,Debug &= help "Debug build" + ,Profile &= help "Profile build"] + ,files = def &= args + } &= help "Build the project" &= auto + +mode = cmdArgsMode $ modes [build,wipe,test_] + &= help "Build helper program" + &= program "maker" + &= summary "Maker v1.0\nMake it" +``` And `--help` produces: Maker v1.0 Make it - + maker [COMMAND] ... [OPTIONS] Build helper program - + Common flags: -? --help Display help message -V --version Print version information - + maker [build] [OPTIONS] [ITEM] Build the project - + -j --threads=NUM Number of threads to use -r --release Release build -d --debug Debug build -p --profile Profile build - + maker wipe [OPTIONS] Clean all build objects - + maker test [OPTIONS] [ANY] Run the test suite - + -j --threads=NUM Number of threads to use diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmdargs-0.10.17/System/Console/CmdArgs/Explicit/Help.hs new/cmdargs-0.10.20/System/Console/CmdArgs/Explicit/Help.hs --- old/cmdargs-0.10.17/System/Console/CmdArgs/Explicit/Help.hs 2017-03-31 21:30:36.000000000 +0200 +++ new/cmdargs-0.10.20/System/Console/CmdArgs/Explicit/Help.hs 2018-01-22 19:47:01.000000000 +0100 @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -fno-warn-orphans #-} -- Not good reasons, but shouldn't be too fatal {- Sample renderings: @@ -6,7 +7,7 @@ programname [OPTIONS] FILE1 FILE2 [FILES] Program to perform some action - + -f --flag description Flag grouping: -a --another description @@ -114,7 +115,7 @@ -- > <options> helpTextOne :: Mode a -> [Text] helpTextOne m = pre ++ ms ++ suf - where + where (pre,suf) = helpTextMode m ms = space $ [Line "Commands:" | not $ null $ groupUnnamed $ modeGroupModes m] ++ helpGroup f (modeGroupModes m) f m = return $ cols [concat $ take 1 $ modeNames m, ' ' : modeHelp m] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmdargs-0.10.17/System/Console/CmdArgs/Explicit/Type.hs new/cmdargs-0.10.20/System/Console/CmdArgs/Explicit/Type.hs --- old/cmdargs-0.10.17/System/Console/CmdArgs/Explicit/Type.hs 2017-03-31 21:30:36.000000000 +0200 +++ new/cmdargs-0.10.20/System/Console/CmdArgs/Explicit/Type.hs 2018-01-22 19:47:01.000000000 +0100 @@ -6,7 +6,7 @@ import Data.Char import Data.List import Data.Maybe -import Data.Monoid +import Data.Semigroup hiding (Arg) import Prelude @@ -23,7 +23,7 @@ --------------------------------------------------------------------- -- UTILITY --- | Parse a boolean, accepts as True: true yes on enabled 1. +-- | Parse a boolean, accepts as True: true yes on enabled 1. parseBool :: String -> Maybe Bool parseBool s | ls `elem` true = Just True | ls `elem` false = Just False @@ -43,14 +43,17 @@ {groupUnnamed :: [a] -- ^ Normal items. ,groupHidden :: [a] -- ^ Items that are hidden (not displayed in the help message). ,groupNamed :: [(Help, [a])] -- ^ Items that have been grouped, along with a description of each group. - } deriving Show + } deriving Show instance Functor Group where fmap f (Group a b c) = Group (map f a) (map f b) (map (second $ map f) c) +instance Semigroup (Group a) where + Group x1 x2 x3 <> Group y1 y2 y3 = Group (x1++y1) (x2++y2) (x3++y3) + instance Monoid (Group a) where mempty = Group [] [] [] - mappend (Group x1 x2 x3) (Group y1 y2 y3) = Group (x1++y1) (x2++y2) (x3++y3) + mappend = (<>) -- | Convert a group into a list. fromGroup :: Group a -> [a] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmdargs-0.10.17/System/Console/CmdArgs/GetOpt.hs new/cmdargs-0.10.20/System/Console/CmdArgs/GetOpt.hs --- old/cmdargs-0.10.17/System/Console/CmdArgs/GetOpt.hs 2017-03-31 21:30:36.000000000 +0200 +++ new/cmdargs-0.10.20/System/Console/CmdArgs/GetOpt.hs 2018-01-22 19:47:01.000000000 +0100 @@ -9,6 +9,7 @@ ) where import System.Console.CmdArgs.Explicit +import System.Console.GetOpt(OptDescr(..), ArgDescr(..)) -- | What to do with options following non-options. @@ -16,36 +17,12 @@ -- /Changes:/ Only 'Permute' is allowed, both @RequireOrder@ and @ReturnInOrder@ -- have been removed. data ArgOrder a = Permute - - --- | Each 'OptDescr' describes a single option/flag. --- --- The arguments to 'Option' are: --- --- * list of short option characters --- --- * list of long option strings (without @\"--\"@, may not be 1 character long) --- --- * argument descriptor --- --- * explanation of option for userdata -data OptDescr a = Option - [Char] - [String] - (ArgDescr a) - String - - --- | Describes whether an option takes an argument or not, and if so --- how the argument is injected into a value of type @a@. -data ArgDescr a - = NoArg a -- ^ no argument expected - | ReqArg (String -> a) String -- ^ option requires argument - | OptArg (Maybe String -> a) String -- ^ optional argument +instance Functor ArgOrder where + fmap _ Permute = Permute -- | Return a string describing the usage of a command, derived from --- the header (first argument) and the options described by the +-- the header (first argument) and the options described by the -- second argument. usageInfo :: String -> [OptDescr a] -> String usageInfo desc flags = unlines $ desc : drop 2 (lines $ show $ convert "" flags) @@ -58,7 +35,7 @@ -- -- * The option descriptions (see 'OptDescr') -- --- * The actual command line arguments (presumably got from +-- * The actual command line arguments (presumably got from -- 'System.Environment.getArgs'). -- -- 'getOpt' returns a triple consisting of the option arguments, a list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmdargs-0.10.17/cmdargs.cabal new/cmdargs-0.10.20/cmdargs.cabal --- old/cmdargs-0.10.17/cmdargs.cabal 2017-03-31 21:30:36.000000000 +0200 +++ new/cmdargs-0.10.20/cmdargs.cabal 2018-01-22 19:47:01.000000000 +0100 @@ -1,13 +1,13 @@ cabal-version: >= 1.18 build-type: Simple name: cmdargs -version: 0.10.17 +version: 0.10.20 license: BSD3 license-file: LICENSE category: Console author: Neil Mitchell <[email protected]> maintainer: Neil Mitchell <[email protected]> -copyright: Neil Mitchell 2009-2017 +copyright: Neil Mitchell 2009-2018 synopsis: Command line argument processing description: This library provides an easy way to define command line parsers. Most users @@ -33,7 +33,7 @@ extra-doc-files: README.md CHANGES.txt -tested-with: GHC==8.0.2, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2 +tested-with: GHC==8.2.2, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2 source-repository head type: git @@ -57,6 +57,9 @@ transformers >= 0.2, process >= 1.0 + if impl(ghc < 8.0) + build-depends: semigroups >= 0.18 + if flag(quotation) build-depends: template-haskell exposed-modules: System.Console.CmdArgs.Quote
