BSD-3-Clause licensed and maintained by Neil Mitchell
This version can be pinned in stack with:cmdargs-0.10.12@sha256:933ea0b92e9faa00c60563a3b3307b4af37be6a63f9ea28ec5cce13992ff5d53,4099

Module documentation for 0.10.12

  • System
    • System.Console
      • System.Console.CmdArgs
        • System.Console.CmdArgs.Annotate
        • System.Console.CmdArgs.Default
        • System.Console.CmdArgs.Explicit
        • System.Console.CmdArgs.GetOpt
        • System.Console.CmdArgs.Helper
        • System.Console.CmdArgs.Implicit
        • System.Console.CmdArgs.Text
        • System.Console.CmdArgs.Verbosity

CmdArgs: Easy Command Line Processing Hackage version Build Status

sample = Sample{hello = def &= help “World argument” &= opt “world”} &= summary “Sample v1”

main = print =<< cmdArgs sample

$ 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 -q –quiet Lower verbosity -h –hello=VALUE World argument (default=world)

{-# LANGUAGE DeriveDataTypeable #-}
module Sample where
import System.Console.CmdArgs

data Sample = Sample {hello :: String}
              deriving (Show, Data, Typeable)

sample = Sample{hello = def}

main = print =<< cmdArgs sample

$ 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

data Sample = Hello {whom :: String}
            | Goodbye
              deriving (Show, Data, Typeable)

hello = Hello{whom = def}
goodbye = Goodbye

main = print =<< cmdArgs (modes [hello,goodbye])

$ 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]

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
  -c --colour --color	        Color the output (requires ANSI terminal)
  -i --ignore=MESSAGE	        Ignore a particular hint
  -s --show                     Show all ignored ideas
     --extension=EXT            File extensions to search (defaults to hs and lhs)
  -X --language=LANG	        Language extension (Arrows, NoCPP)
  -u --utf8	                    Use UTF-8 text encoding
     --encoding=ENC	            Choose the text encoding
  -f --find=FILE	            Find hints in a Haskell file
  -t --test	                    Run in test mode
  -d --datadir=DIR	            Override the data directory
     --cpp-define=NAME[=VALUE]  CPP #define
     --cpp-include=DIR	        CPP include path
  -? --help	                    Display help message
  -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 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
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

Changes

Changelog for CmdArgs

0.10.12
GHC 7.2 compatibility
0.10.11
#15, never put [brackets] around optional args in Explicit
0.10.10
#14, fix @ file arguments
0.10.9
#10, fix versionArgs (broken in 0.10.8)
0.10.8
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
#1, fix timestamps in .tar.gz dist file
0.10.6
#625, more documentation about args/argPos
#626, ensure initial lists don't get reversed (fix after #610)
0.10.5
#615, support lists inside a newtype
0.10.4
#610, make sure it is O(n) to append arguments, not O(n^2)
0.10.3
Append list items under an enum
Support &= ignore on enum fields
0.10.2
Relax upper bounds to be GHC 7.7 compatible
0.10.1
#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
Revert to 0.9.6, including modeExpandAt
0.9.7
Revert to 0.9.5, to fix up PVP breakage
0.9.6
#539, hopefully more fixes to compiling in profile mode
#522, add modeExpandAt and noAtExpand annotation
#522, don't @expand after --
0.9.5
Don't specify TH extension unless quotation is true
0.9.4
#539, specify the TH extension in the Cabal file
Allow transformers 0.3.*
Correct copyright in license and cabal file
0.9.3
Add expandArgsAt and support for @ flag file directives
0.9.2
Don't build the test program if quotation is turned off
0.9.1
Improve the documentation for the Explicit module
#433, propagate groupname on modes in the Implicit code
0.9
#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
#461, fix the translation for enum/enum_
Make showHelp take an argument for the prefix bits
Add Helper interface, and initial cmdargs-browser code
Add splitArgs/joinArgs
0.8
#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
No changes, just a version bump to allow requiring the GHC fix
0.6.10
Change the annotate module to cope better with GHC's CSE
0.6.9
#422, support newtype value as the underlying type
0.6.8
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
#395, don't put two newlines after --help or --version
0.6.6
#392, support helpArgs [groupname "something"]
0.6.5
Don't fail with ambiguous enum if you exactly match a value
Put errors on stderr
0.6.4
Eliminate the filepath dependence
0.6.3
Switch mtl for transformers
0.6.2
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
Build on GHC 6.10, don't rely on record name disambiguation
0.6
Add ignore annotation for modes and flags
#350, make top-level help appear properly
0.5
#351, name/explicit attributes on mode were broken (regression)
0.4
#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
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
#252, add support for grouped flags/modes
#333, support missing fields
Add support for reading tuple values (including nested)
#292, add support for automatic enumerations
#221, make argpos work with non-string fields
#222, support opt and args together
#230, different modes can share short flags
#295, make verbosity flags explicit
#231, add support for Maybe
#256, add --option=false support
Complete rewrite to introduce Explicit module
0.1.1
Start of changelog