update to cmdargs 0.8 API

Between 0.7 and 0.8, modeArgs changed from

modeArgs :: Maybe (Arg a)

to

modeArgs :: ([Arg a], Maybe (Arg a))
This commit is contained in:
Clint Adams 2011-08-30 21:41:25 +00:00
parent b8aefb23cf
commit 5ead6d05b1
7 changed files with 20 additions and 20 deletions

4
NOTES
View File

@ -1540,7 +1540,7 @@ vtymode = Mode {
,modeReform = const Nothing ,modeReform = const Nothing
,modeHelp = "" ,modeHelp = ""
,modeHelpSuffix = [] ,modeHelpSuffix = []
,modeArgs = Nothing ,modeArgs = ([], Nothing)
,modeGroupFlags = Group { ,modeGroupFlags = Group {
groupUnnamed = [] groupUnnamed = []
,groupHidden = [] ,groupHidden = []
@ -1695,7 +1695,7 @@ progmode = Mode {
,modeReform = const Nothing ,modeReform = const Nothing
,modeHelp = "hledger options test" ,modeHelp = "hledger options test"
,modeHelpSuffix = [] ,modeHelpSuffix = []
,modeArgs = Just cliargs ,modeArgs = ([], Just cliargs)
,modeGroupFlags = Group { ,modeGroupFlags = Group {
groupUnnamed = [] groupUnnamed = []
,groupHidden = [] ,groupHidden = []

View File

@ -39,7 +39,7 @@ executable hledger-chart
,hledger-lib == 0.15 ,hledger-lib == 0.15
,HUnit ,HUnit
,base >= 3 && < 5 ,base >= 3 && < 5
,cmdargs >= 0.7 && < 0.8 ,cmdargs >= 0.8 && < 0.9
,containers ,containers
-- ,csv -- ,csv
-- ,directory -- ,directory

View File

@ -53,7 +53,7 @@ library
Build-Depends: Build-Depends:
base >= 3 && < 5 base >= 3 && < 5
,bytestring ,bytestring
,cmdargs >= 0.7 && < 0.8 ,cmdargs >= 0.8 && < 0.9
,containers ,containers
,directory ,directory
,filepath ,filepath

View File

@ -39,7 +39,7 @@ executable hledger-vty
,hledger-lib == 0.15 ,hledger-lib == 0.15
,HUnit ,HUnit
,base >= 3 && < 5 ,base >= 3 && < 5
,cmdargs >= 0.7 && < 0.8 ,cmdargs >= 0.8 && < 0.9
-- ,containers -- ,containers
-- ,csv -- ,csv
-- ,directory -- ,directory

View File

@ -68,7 +68,7 @@ executable hledger-web
,HUnit ,HUnit
,base >= 4 && < 5 ,base >= 4 && < 5
,bytestring ,bytestring
,cmdargs >= 0.7 && < 0.8 ,cmdargs >= 0.8 && < 0.9
-- ,containers -- ,containers
-- ,csv -- ,csv
,directory ,directory

View File

@ -46,7 +46,7 @@ defmode = Mode {
,modeCheck = Right ,modeCheck = Right
,modeReform = const Nothing ,modeReform = const Nothing
,modeGroupFlags = toGroup [] ,modeGroupFlags = toGroup []
,modeArgs = Nothing ,modeArgs = ([], Nothing)
,modeGroupModes = toGroup [] ,modeGroupModes = toGroup []
} }
@ -59,7 +59,7 @@ mainmode addons = defmode {
,groupHidden = [flagNone ["binary-filename"] (setboolopt "binary-filename") "show the download filename for this executable, and exit"] ,groupHidden = [flagNone ["binary-filename"] (setboolopt "binary-filename") "show the download filename for this executable, and exit"]
,groupNamed = [] ,groupNamed = []
} }
,modeArgs = Just mainargsflag ,modeArgs = ([], Just mainargsflag)
,modeGroupModes = Group { ,modeGroupModes = Group {
groupUnnamed = [ groupUnnamed = [
] ]
@ -94,7 +94,7 @@ addonmode name = defmode {
,groupHidden = [] ,groupHidden = []
,groupNamed = [(generalflagstitle, generalflags1)] ,groupNamed = [(generalflagstitle, generalflags1)]
} }
,modeArgs = Just addonargsflag ,modeArgs = ([], Just addonargsflag)
} }
help_postscript = [ help_postscript = [
@ -155,7 +155,7 @@ commandmode names = defmode {modeNames=names, modeValue=[("command",headDef "" n
addmode = (commandmode ["add"]) { addmode = (commandmode ["add"]) {
modeHelp = "prompt for new transactions and append them to the journal" modeHelp = "prompt for new transactions and append them to the journal"
,modeHelpSuffix = ["Defaults come from previous similar transactions; use query patterns to restrict these."] ,modeHelpSuffix = ["Defaults come from previous similar transactions; use query patterns to restrict these."]
,modeArgs = Just commandargsflag ,modeArgs = ([], Just commandargsflag)
,modeGroupFlags = Group { ,modeGroupFlags = Group {
groupUnnamed = [ groupUnnamed = [
flagNone ["no-new-accounts"] (\opts -> setboolopt "no-new-accounts" opts) "don't allow creating new accounts" flagNone ["no-new-accounts"] (\opts -> setboolopt "no-new-accounts" opts) "don't allow creating new accounts"
@ -168,7 +168,7 @@ addmode = (commandmode ["add"]) {
convertmode = (commandmode ["convert"]) { convertmode = (commandmode ["convert"]) {
modeValue = [("command","convert")] modeValue = [("command","convert")]
,modeHelp = "show the specified CSV file as hledger journal entries" ,modeHelp = "show the specified CSV file as hledger journal entries"
,modeArgs = Just $ flagArg (\s opts -> Right $ setopt "args" s opts) "[CSVFILE]" ,modeArgs = ([], Just $ flagArg (\s opts -> Right $ setopt "args" s opts) "[CSVFILE]")
,modeGroupFlags = Group { ,modeGroupFlags = Group {
groupUnnamed = [ groupUnnamed = [
flagReq ["rules-file"] (\s opts -> Right $ setopt "rules-file" s opts) "FILE" "rules file to use (default: CSVFILE.rules)" flagReq ["rules-file"] (\s opts -> Right $ setopt "rules-file" s opts) "FILE" "rules file to use (default: CSVFILE.rules)"
@ -180,7 +180,7 @@ convertmode = (commandmode ["convert"]) {
testmode = (commandmode ["test"]) { testmode = (commandmode ["test"]) {
modeHelp = "run self-tests, or just the ones matching REGEXPS" modeHelp = "run self-tests, or just the ones matching REGEXPS"
,modeArgs = Just $ flagArg (\s opts -> Right $ setopt "args" s opts) "[REGEXPS]" ,modeArgs = ([], Just $ flagArg (\s opts -> Right $ setopt "args" s opts) "[REGEXPS]")
,modeGroupFlags = Group { ,modeGroupFlags = Group {
groupUnnamed = [] groupUnnamed = []
,groupHidden = [] ,groupHidden = []
@ -190,7 +190,7 @@ testmode = (commandmode ["test"]) {
accountsmode = (commandmode ["accounts","balance"]) { accountsmode = (commandmode ["accounts","balance"]) {
modeHelp = "(or balance) show matched accounts and their balances" modeHelp = "(or balance) show matched accounts and their balances"
,modeArgs = Just commandargsflag ,modeArgs = ([], Just commandargsflag)
,modeGroupFlags = Group { ,modeGroupFlags = Group {
groupUnnamed = [ groupUnnamed = [
flagNone ["flat"] (\opts -> setboolopt "flat" opts) "show full account names, unindented" flagNone ["flat"] (\opts -> setboolopt "flat" opts) "show full account names, unindented"
@ -206,7 +206,7 @@ accountsmode = (commandmode ["accounts","balance"]) {
entriesmode = (commandmode ["entries","print"]) { entriesmode = (commandmode ["entries","print"]) {
modeHelp = "(or print) show matched journal entries" modeHelp = "(or print) show matched journal entries"
,modeArgs = Just commandargsflag ,modeArgs = ([], Just commandargsflag)
,modeGroupFlags = Group { ,modeGroupFlags = Group {
groupUnnamed = [] groupUnnamed = []
,groupHidden = [] ,groupHidden = []
@ -216,7 +216,7 @@ entriesmode = (commandmode ["entries","print"]) {
postingsmode = (commandmode ["postings","register"]) { postingsmode = (commandmode ["postings","register"]) {
modeHelp = "(or register) show matched postings and running total" modeHelp = "(or register) show matched postings and running total"
,modeArgs = Just commandargsflag ,modeArgs = ([], Just commandargsflag)
,modeGroupFlags = Group { ,modeGroupFlags = Group {
groupUnnamed = [] groupUnnamed = []
,groupHidden = [] ,groupHidden = []
@ -226,7 +226,7 @@ postingsmode = (commandmode ["postings","register"]) {
transactionsmode = (commandmode ["transactions"]) { transactionsmode = (commandmode ["transactions"]) {
modeHelp = "show matched transactions and balance in some account(s)" modeHelp = "show matched transactions and balance in some account(s)"
,modeArgs = Just commandargsflag ,modeArgs = ([], Just commandargsflag)
,modeGroupFlags = Group { ,modeGroupFlags = Group {
groupUnnamed = [] groupUnnamed = []
,groupHidden = [] ,groupHidden = []
@ -237,7 +237,7 @@ transactionsmode = (commandmode ["transactions"]) {
activitymode = (commandmode ["activity","histogram"]) { activitymode = (commandmode ["activity","histogram"]) {
modeHelp = "show a barchart of transactions per interval" modeHelp = "show a barchart of transactions per interval"
,modeHelpSuffix = ["The default interval is daily."] ,modeHelpSuffix = ["The default interval is daily."]
,modeArgs = Just commandargsflag ,modeArgs = ([], Just commandargsflag)
,modeGroupFlags = Group { ,modeGroupFlags = Group {
groupUnnamed = [] groupUnnamed = []
,groupHidden = [] ,groupHidden = []
@ -247,7 +247,7 @@ activitymode = (commandmode ["activity","histogram"]) {
statsmode = (commandmode ["stats"]) { statsmode = (commandmode ["stats"]) {
modeHelp = "show quick statistics for a journal (or part of it)" modeHelp = "show quick statistics for a journal (or part of it)"
,modeArgs = Just commandargsflag ,modeArgs = ([], Just commandargsflag)
,modeGroupFlags = Group { ,modeGroupFlags = Group {
groupUnnamed = [] groupUnnamed = []
,groupHidden = [] ,groupHidden = []

View File

@ -61,7 +61,7 @@ library
hledger-lib == 0.15 hledger-lib == 0.15
,base >= 3 && < 5 ,base >= 3 && < 5
,containers ,containers
,cmdargs >= 0.7 && < 0.8 ,cmdargs >= 0.8 && < 0.9
,csv ,csv
,directory ,directory
,filepath ,filepath
@ -112,7 +112,7 @@ executable hledger
hledger-lib == 0.15 hledger-lib == 0.15
,base >= 3 && < 5 ,base >= 3 && < 5
,containers ,containers
,cmdargs >= 0.7 && < 0.8 ,cmdargs >= 0.8 && < 0.9
,csv ,csv
,directory ,directory
,filepath ,filepath