Reduce simple lambda

This commit is contained in:
Jakob Schöttl 2019-02-09 20:46:42 +01:00 committed by Simon Michael
parent 94753f1cea
commit 98d7c073c7
10 changed files with 46 additions and 46 deletions

View File

@ -26,23 +26,23 @@ prognameandversion :: String
prognameandversion = progname ++ " " ++ version :: String
uiflags = [
-- flagNone ["debug-ui"] (\opts -> setboolopt "rules-file" opts) "run with no terminal output, showing console"
flagNone ["watch"] (\opts -> setboolopt "watch" opts) "watch for data and date changes and reload automatically"
-- flagNone ["debug-ui"] (setboolopt "rules-file") "run with no terminal output, showing console"
flagNone ["watch"] (setboolopt "watch") "watch for data and date changes and reload automatically"
,flagReq ["theme"] (\s opts -> Right $ setopt "theme" s opts) "THEME" ("use this custom display theme ("++intercalate ", " themeNames++")")
,flagReq ["register"] (\s opts -> Right $ setopt "register" s opts) "ACCTREGEX" "start in the (first) matched account's register"
,flagNone ["change"] (\opts -> setboolopt "change" opts)
,flagNone ["change"] (setboolopt "change")
"show period balances (changes) at startup instead of historical balances"
-- ,flagNone ["cumulative"] (\opts -> setboolopt "cumulative" opts)
-- ,flagNone ["cumulative"] (setboolopt "cumulative")
-- "show balance change accumulated across periods (in multicolumn reports)"
-- ,flagNone ["historical","H"] (\opts -> setboolopt "historical" opts)
-- ,flagNone ["historical","H"] (setboolopt "historical")
-- "show historical ending balance in each period (includes postings before report start date)\n "
,flagNone ["flat","F"] (\opts -> setboolopt "flat" opts) "show accounts as a list (default)"
,flagNone ["tree","T"] (\opts -> setboolopt "tree" opts) "show accounts as a tree"
-- ,flagNone ["present"] (\opts -> setboolopt "present" opts) "exclude transactions dated later than today (default)"
,flagNone ["future"] (\opts -> setboolopt "future" opts) "show transactions dated later than today (normally hidden)"
,flagNone ["flat","F"] (setboolopt "flat") "show accounts as a list (default)"
,flagNone ["tree","T"] (setboolopt "tree") "show accounts as a tree"
-- ,flagNone ["present"] (setboolopt "present") "exclude transactions dated later than today (default)"
,flagNone ["future"] (setboolopt "future") "show transactions dated later than today (normally hidden)"
-- ,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "with --flat, omit this many leading account name components"
-- ,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format"
-- ,flagNone ["no-elide"] (\opts -> setboolopt "no-elide" opts) "don't compress empty parent accounts on one line"
-- ,flagNone ["no-elide"] (setboolopt "no-elide") "don't compress empty parent accounts on one line"
]
--uimode :: Mode [([Char], [Char])]

View File

@ -36,10 +36,10 @@ import Hledger.Cli.CliOptions
-- | Command line options for this command.
accountsmode = hledgerCommandMode
$(embedFileRelative "Hledger/Cli/Commands/Accounts.txt")
[flagNone ["declared"] (\opts -> setboolopt "declared" opts) "show account names declared with account directives"
,flagNone ["used"] (\opts -> setboolopt "used" opts) "show account names referenced by transactions"
,flagNone ["tree"] (\opts -> setboolopt "tree" opts) "show short account names, as a tree"
,flagNone ["flat"] (\opts -> setboolopt "flat" opts) "show full account names, as a list (default)"
[flagNone ["declared"] (setboolopt "declared") "show account names declared with account directives"
,flagNone ["used"] (setboolopt "used") "show account names referenced by transactions"
,flagNone ["tree"] (setboolopt "tree") "show short account names, as a tree"
,flagNone ["flat"] (setboolopt "flat") "show full account names, as a list (default)"
,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"
]
[generalflagsgroup1]

View File

@ -49,7 +49,7 @@ import Hledger.Cli.Commands.Register (postingsReportAsText)
addmode = hledgerCommandMode
$(embedFileRelative "Hledger/Cli/Commands/Add.txt")
[flagNone ["no-new-accounts"] (\opts -> setboolopt "no-new-accounts" opts) "don't allow creating new accounts"]
[flagNone ["no-new-accounts"] (setboolopt "no-new-accounts") "don't allow creating new accounts"]
[generalflagsgroup2]
[]
([], Just $ argsFlag "[QUERY]")

View File

@ -271,22 +271,22 @@ import Hledger.Read.CsvReader (CSV, printCSV)
-- | Command line options for this command.
balancemode = hledgerCommandMode
$(embedFileRelative "Hledger/Cli/Commands/Balance.txt")
([flagNone ["change"] (\opts -> setboolopt "change" opts)
([flagNone ["change"] (setboolopt "change")
"show balance change in each period (default)"
,flagNone ["cumulative"] (\opts -> setboolopt "cumulative" opts)
,flagNone ["cumulative"] (setboolopt "cumulative")
"show balance change accumulated across periods (in multicolumn reports)"
,flagNone ["historical","H"] (\opts -> setboolopt "historical" opts)
,flagNone ["historical","H"] (setboolopt "historical")
"show historical ending balance in each period (includes postings before report start date)\n "
,flagNone ["tree"] (\opts -> setboolopt "tree" opts) "show accounts as a tree; amounts include subaccounts (default in simple reports)"
,flagNone ["flat"] (\opts -> setboolopt "flat" opts) "show accounts as a list; amounts exclude subaccounts except when account is depth-clipped (default in multicolumn reports)\n "
,flagNone ["average","A"] (\opts -> setboolopt "average" opts) "show a row average column (in multicolumn reports)"
,flagNone ["row-total","T"] (\opts -> setboolopt "row-total" opts) "show a row total column (in multicolumn reports)"
,flagNone ["no-total","N"] (\opts -> setboolopt "no-total" opts) "omit the final total row"
,flagNone ["tree"] (setboolopt "tree") "show accounts as a tree; amounts include subaccounts (default in simple reports)"
,flagNone ["flat"] (setboolopt "flat") "show accounts as a list; amounts exclude subaccounts except when account is depth-clipped (default in multicolumn reports)\n "
,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)"
,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)"
,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row"
,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "omit N leading account name parts (in flat mode)"
,flagNone ["no-elide"] (\opts -> setboolopt "no-elide" opts) "don't squash boring parent accounts (in tree mode)"
,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode)"
,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"
,flagNone ["pretty-tables"] (\opts -> setboolopt "pretty-tables" opts) "use unicode to display prettier tables"
,flagNone ["sort-amount","S"] (\opts -> setboolopt "sort-amount" opts) "sort by amount instead of account code/name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed."
,flagNone ["pretty-tables"] (setboolopt "pretty-tables") "use unicode to display prettier tables"
,flagNone ["sort-amount","S"] (setboolopt "sort-amount") "sort by amount instead of account code/name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed."
,flagNone ["budget"] (setboolopt "budget") "show performance compared to budget goals defined by periodic transactions"
,flagNone ["invert"] (setboolopt "invert") "display all amounts with reversed sign"
,flagNone ["transpose"] (setboolopt "transpose") "transpose rows and columns"

View File

@ -14,7 +14,7 @@ import Text.Printf
checkdatesmode :: Mode RawOpts
checkdatesmode = hledgerCommandMode
($(embedFileRelative "Hledger/Cli/Commands/Checkdates.txt"))
[flagNone ["strict"] (\opts -> setboolopt "strict" opts) "makes date comparing strict"]
[flagNone ["strict"] (setboolopt "strict") "makes date comparing strict"]
[generalflagsgroup1]
[]
([], Just $ argsFlag "[QUERY]")

View File

@ -17,8 +17,8 @@ import Hledger.Cli.CliOptions
closemode = hledgerCommandMode
$(embedFileRelative "Hledger/Cli/Commands/Close.txt")
[flagNone ["opening"] (\opts -> setboolopt "opening" opts) "show just opening transaction"
,flagNone ["closing"] (\opts -> setboolopt "closing" opts) "show just closing transaction"
[flagNone ["opening"] (setboolopt "opening") "show just opening transaction"
,flagNone ["closing"] (setboolopt "closing") "show just closing transaction"
]
[generalflagsgroup1]
[]

View File

@ -19,7 +19,7 @@ import Text.Printf
importmode = hledgerCommandMode
($(embedFileRelative "Hledger/Cli/Commands/Import.txt"))
[flagNone ["dry-run"] (\opts -> setboolopt "dry-run" opts) "just show the transactions to be imported"]
[flagNone ["dry-run"] (setboolopt "dry-run") "just show the transactions to be imported"]
[generalflagsgroup1]
[]
([], Just $ argsFlag "FILE [...]")

View File

@ -29,13 +29,13 @@ import Hledger.Cli.Utils
registermode = hledgerCommandMode
($(embedFileRelative "Hledger/Cli/Commands/Register.txt"))
([flagNone ["cumulative"] (\opts -> setboolopt "change" opts)
([flagNone ["cumulative"] (setboolopt "change")
"show running total from report start date (default)"
,flagNone ["historical","H"] (\opts -> setboolopt "historical" opts)
,flagNone ["historical","H"] (setboolopt "historical")
"show historical running total/balance (includes postings before report start date)\n "
,flagNone ["average","A"] (\opts -> setboolopt "average" opts)
,flagNone ["average","A"] (setboolopt "average")
"show running average of posting amounts instead of total (implies --empty)"
,flagNone ["related","r"] (\opts -> setboolopt "related" opts) "show postings' siblings instead"
,flagNone ["related","r"] (setboolopt "related") "show postings' siblings instead"
,flagReq ["width","w"] (\s opts -> Right $ setopt "width" s opts) "N"
("set output width (default: " ++
#ifdef mingw32_HOST_OS

View File

@ -15,7 +15,7 @@ import Hledger.Cli.CliOptions
tagsmode = hledgerCommandMode
($(embedFileRelative "Hledger/Cli/Commands/Tags.txt"))
[] -- [flagNone ["strict"] (\opts -> setboolopt "strict" opts) "makes date comparing strict"] --
[] -- [flagNone ["strict"] (setboolopt "strict") "makes date comparing strict"] --
[generalflagsgroup1]
[]
([], Just $ argsFlag "[TAGREGEX [QUERY...]]")

View File

@ -84,26 +84,26 @@ compoundBalanceCommandMode :: CompoundBalanceCommandSpec -> Mode RawOpts
compoundBalanceCommandMode CompoundBalanceCommandSpec{..} =
hledgerCommandMode
cbcdoc
[flagNone ["change"] (\opts -> setboolopt "change" opts)
[flagNone ["change"] (setboolopt "change")
("show balance change in each period" ++ defType PeriodChange)
,flagNone ["cumulative"] (\opts -> setboolopt "cumulative" opts)
,flagNone ["cumulative"] (setboolopt "cumulative")
("show balance change accumulated across periods (in multicolumn reports)"
++ defType CumulativeChange
)
,flagNone ["historical","H"] (\opts -> setboolopt "historical" opts)
,flagNone ["historical","H"] (setboolopt "historical")
("show historical ending balance in each period (includes postings before report start date)"
++ defType HistoricalBalance
)
,flagNone ["flat"] (\opts -> setboolopt "flat" opts) "show accounts as a list"
,flagNone ["flat"] (setboolopt "flat") "show accounts as a list"
,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"
,flagNone ["no-total","N"] (\opts -> setboolopt "no-total" opts) "omit the final total row"
,flagNone ["tree"] (\opts -> setboolopt "tree" opts) "show accounts as a tree; amounts include subaccounts (default in simple reports)"
,flagNone ["average","A"] (\opts -> setboolopt "average" opts) "show a row average column (in multicolumn reports)"
,flagNone ["row-total","T"] (\opts -> setboolopt "row-total" opts) "show a row total column (in multicolumn reports)"
,flagNone ["no-elide"] (\opts -> setboolopt "no-elide" opts) "don't squash boring parent accounts (in tree mode)"
,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row"
,flagNone ["tree"] (setboolopt "tree") "show accounts as a tree; amounts include subaccounts (default in simple reports)"
,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)"
,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)"
,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode)"
,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"
,flagNone ["pretty-tables"] (\opts -> setboolopt "pretty-tables" opts) "use unicode when displaying tables"
,flagNone ["sort-amount","S"] (\opts -> setboolopt "sort-amount" opts) "sort by amount instead of account code/name"
,flagNone ["pretty-tables"] (setboolopt "pretty-tables") "use unicode when displaying tables"
,flagNone ["sort-amount","S"] (setboolopt "sort-amount") "sort by amount instead of account code/name"
,outputFormatFlag
,outputFileFlag
]