console-program 0.4.0.0 → 0.4.0.1
raw patch · 3 files changed
+18/−15 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Examples/Full.hs +5/−5
- Examples/Simple.hs +4/−4
- console-program.cabal +9/−6
Examples/Full.hs view
@@ -3,7 +3,7 @@ import System.Console.Command (- Commands,Tree(Node),Command(..),withOption,withNonOption,io+ Commands,Tree(Node),Command,command,withOption,withNonOption,io ) import System.Console.Program (single,showUsage) import qualified System.Console.Argument as Argument@@ -14,7 +14,7 @@ myCommands :: Commands IO myCommands = Node- (Command "count" "A program for counting" . io $ putStrLn "No command given; try \"count help\".")+ (command "count" "A program for counting" . io $ putStrLn "No command given; try \"count help\".") [ Node countUp [] , Node countDown []@@ -22,7 +22,7 @@ ] countUp,countDown,help :: Command IO-countUp = Command+countUp = command { name = "up" , description = "Count up"@@ -30,13 +30,13 @@ then putStrLn "Counting quietly!" else mapM_ print [1 ..] }-countDown = Command+countDown = command { name = "down" , description = "Count down from INT." , action = withNonOption Argument.natural $ \ upperBound -> io $ mapM_ print [upperBound, pred upperBound .. 1] }-help = Command "help" "Show usage info" $ io (showUsage myCommands)+help = command "help" "Show usage info" $ io (showUsage myCommands) -- Custom data type to describe a verbosity level.
Examples/Simple.hs view
@@ -1,19 +1,19 @@ module Simple where -import System.Console.Command (Commands,Tree(Node),Command(..),io)+import System.Console.Command (Commands,Tree(Node),command,io) import System.Console.Program (single) myCommands :: Commands IO myCommands = Node- (Command "say" "" . io $ putStrLn "No command given.")+ (command "say" "" . io $ putStrLn "No command given.") [ Node- (Command "yes" "" . io $ putStrLn "Yes!")+ (command "yes" "" . io $ putStrLn "Yes!") [] , Node- (Command "no" "" . io $ putStrLn "No!")+ (command "no" "" . io $ putStrLn "No!") [] ]
console-program.cabal view
@@ -1,19 +1,22 @@ name: console-program-version: 0.4.0.0+version: 0.4.0.1 cabal-Version: >= 1.6 license: BSD3 author: Arie Peterson maintainer: ariep@xs4all.nl category: Console-synopsis: Interpret the command line and contents of a config file as commands and options+synopsis: Interpret the command line and settings in a config file as commands and options description:- This library provides an infrastructure to build command line programs. It provides the following features:+ This library provides a framework to build command line programs. .- - declare any number of \"commands\" (modes of operation) of the program; .- - declare options of these commands;+ The constructed program can have several \"commands\" that provide different modes of operation.+ Options can be declared to allow fine-tuning of the behaviour of the program.+ These options are read from the command line when running the program+ and from a simple configuration file. .- - collect options from a configuration file and the command line, and execute the proper command.+ .+ Additionally, there is an interactive mode that reads and executes commands from standard input. . . Examples of using this library may be found in the Examples directory in the package tarball.