parseargs 0.1.3 → 0.1.3.1
raw patch · 4 files changed
+50/−40 lines, 4 filesdep ~basedep ~containersPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, containers
API changes (from Hackage documentation)
- System.Console.ParseArgs: ArgsTrailing :: ArgsComplete
+ System.Console.ParseArgs: ArgsTrailing :: String -> ArgsComplete
Files
- COPYING +32/−24
- System/Console/ParseArgs.hs +13/−11
- parseargs-example.hs +2/−1
- parseargs.cabal +3/−4
COPYING view
@@ -1,26 +1,34 @@-Copyright (c) The Regents of the University of California.-All rights reserved.+Copyright © 2008 Bart Massey -Redistribution and use in source and binary forms, with or without-modification, are permitted provided that the following conditions-are met:-1. Redistributions of source code must retain the above copyright- notice, this list of conditions and the following disclaimer.-2. Redistributions in binary form must reproduce the above copyright- notice, this list of conditions and the following disclaimer in the- documentation and/or other materials provided with the distribution.-3. Neither the name of the University nor the names of its contributors- may be used to endorse or promote products derived from this software- without specific prior written permission.+Redistribution and use in source and binary forms, with or+without modification, are permitted provided that the+following conditions are met: -THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE-ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF-SUCH DAMAGE.+ 1. Redistributions of source code must retain the above+ copyright notice, this list of conditions and the+ following disclaimer.++ 2. Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the+ following disclaimer in the documentation and/or other+ materials provided with the distribution.++ 3. Neither the name of the copyright holders nor the names+ of contributors may be used to endorse or promote+ products derived from this software without specific+ prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND+CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+POSSIBILITY OF SUCH DAMAGE.
System/Console/ParseArgs.hs view
@@ -305,15 +305,17 @@ map (\arg -> (f_field arg, arg))) args -- |How \"sloppy\" the parse is.-data ArgsComplete = ArgsComplete -- ^Any extraneous arguments- -- (unparseable from description)- -- will cause the parser to fail.- | ArgsTrailing -- ^Trailing extraneous arguments are- -- permitted, and will be skipped,- -- saved, and returned.- | ArgsInterspersed -- ^All extraneous arguments are- -- permitted, and will be skipped,- -- saved, and returned.+data ArgsComplete = ArgsComplete -- ^Any extraneous arguments+ -- (unparseable from description)+ -- will cause the parser to fail.+ | ArgsTrailing String -- ^Trailing extraneous arguments are+ -- permitted, and will be skipped,+ -- saved, and returned. The+ -- constructor argument is the+ -- name of the args.+ | ArgsInterspersed -- ^All extraneous arguments are+ -- permitted, and will be skipped,+ -- saved, and returned. -- |The iteration function is given a state and a list, and -- expected to produce a new state and list. The function@@ -418,8 +420,8 @@ (" " ++ unwords (map arg_string posn_args)) ++ (case acomplete of ArgsComplete -> ""- _ -> " [--] ...") ++- "\n"+ ArgsTrailing s -> " [--] [" ++ s ++ " ...]"+ ArgsInterspersed -> " ... [--] ...") ++ "\n" --- argument lines arg_lines = concatMap (arg_line n) argd where arg_line n a =
parseargs-example.hs view
@@ -46,7 +46,7 @@ argDesc = "Test optional string" }] main = do- args <- parseArgsIO ArgsComplete argd+ args <- parseArgsIO (ArgsTrailing "junk") argd putStrLn "parse successful" when (gotArg args OptionFlag) (putStrLn "saw flag")@@ -60,3 +60,4 @@ case (getArg args OptionOptional) of Just s -> putStrLn ("saw optional " ++ s) Nothing -> return ()+ putStrLn ("saw rest: " ++ show (argsRest args))
parseargs.cabal view
@@ -1,7 +1,7 @@ Name: parseargs Build-Type: Simple Description: Parse command-line arguments-Version: 0.1.3+Version: 0.1.3.1 Cabal-Version: >= 1.2 License: BSD3 License-File: COPYING@@ -11,14 +11,13 @@ Homepage: http://wiki.cs.pdx.edu/bartforge/parseargs Category: System.Console Synopsis: Command-line argument parsing library for Haskell programs-Stability: Alpha Extra-Source-Files: README Library- Build-Depends: base <= 5+ Build-Depends: base <= 5, containers <= 1 Exposed-Modules: System.Console.ParseArgs Executable parseargs-example- Build-Depends: base <= 5, containers <= 0.4+ Build-Depends: base <= 5 Main-Is: parseargs-example.hs Other-Modules: System.Console.ParseArgs