Reduce simple lambda
This commit is contained in:
parent
94753f1cea
commit
98d7c073c7
@ -26,23 +26,23 @@ prognameandversion :: String
|
|||||||
prognameandversion = progname ++ " " ++ version :: String
|
prognameandversion = progname ++ " " ++ version :: String
|
||||||
|
|
||||||
uiflags = [
|
uiflags = [
|
||||||
-- flagNone ["debug-ui"] (\opts -> setboolopt "rules-file" opts) "run with no terminal output, showing console"
|
-- flagNone ["debug-ui"] (setboolopt "rules-file") "run with no terminal output, showing console"
|
||||||
flagNone ["watch"] (\opts -> setboolopt "watch" opts) "watch for data and date changes and reload automatically"
|
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 ["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"
|
,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"
|
"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)"
|
-- "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 "
|
-- "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 ["flat","F"] (setboolopt "flat") "show accounts as a list (default)"
|
||||||
,flagNone ["tree","T"] (\opts -> setboolopt "tree" opts) "show accounts as a tree"
|
,flagNone ["tree","T"] (setboolopt "tree") "show accounts as a tree"
|
||||||
-- ,flagNone ["present"] (\opts -> setboolopt "present" opts) "exclude transactions dated later than today (default)"
|
-- ,flagNone ["present"] (setboolopt "present") "exclude transactions dated later than today (default)"
|
||||||
,flagNone ["future"] (\opts -> setboolopt "future" opts) "show transactions dated later than today (normally hidden)"
|
,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 ["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"
|
-- ,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])]
|
--uimode :: Mode [([Char], [Char])]
|
||||||
|
|||||||
@ -36,10 +36,10 @@ import Hledger.Cli.CliOptions
|
|||||||
-- | Command line options for this command.
|
-- | Command line options for this command.
|
||||||
accountsmode = hledgerCommandMode
|
accountsmode = hledgerCommandMode
|
||||||
$(embedFileRelative "Hledger/Cli/Commands/Accounts.txt")
|
$(embedFileRelative "Hledger/Cli/Commands/Accounts.txt")
|
||||||
[flagNone ["declared"] (\opts -> setboolopt "declared" opts) "show account names declared with account directives"
|
[flagNone ["declared"] (setboolopt "declared") "show account names declared with account directives"
|
||||||
,flagNone ["used"] (\opts -> setboolopt "used" opts) "show account names referenced by transactions"
|
,flagNone ["used"] (setboolopt "used") "show account names referenced by transactions"
|
||||||
,flagNone ["tree"] (\opts -> setboolopt "tree" opts) "show short account names, as a tree"
|
,flagNone ["tree"] (setboolopt "tree") "show short account names, as a tree"
|
||||||
,flagNone ["flat"] (\opts -> setboolopt "flat" opts) "show full account names, as a list (default)"
|
,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"
|
,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"
|
||||||
]
|
]
|
||||||
[generalflagsgroup1]
|
[generalflagsgroup1]
|
||||||
|
|||||||
@ -49,7 +49,7 @@ import Hledger.Cli.Commands.Register (postingsReportAsText)
|
|||||||
|
|
||||||
addmode = hledgerCommandMode
|
addmode = hledgerCommandMode
|
||||||
$(embedFileRelative "Hledger/Cli/Commands/Add.txt")
|
$(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]
|
[generalflagsgroup2]
|
||||||
[]
|
[]
|
||||||
([], Just $ argsFlag "[QUERY]")
|
([], Just $ argsFlag "[QUERY]")
|
||||||
|
|||||||
@ -271,22 +271,22 @@ import Hledger.Read.CsvReader (CSV, printCSV)
|
|||||||
-- | Command line options for this command.
|
-- | Command line options for this command.
|
||||||
balancemode = hledgerCommandMode
|
balancemode = hledgerCommandMode
|
||||||
$(embedFileRelative "Hledger/Cli/Commands/Balance.txt")
|
$(embedFileRelative "Hledger/Cli/Commands/Balance.txt")
|
||||||
([flagNone ["change"] (\opts -> setboolopt "change" opts)
|
([flagNone ["change"] (setboolopt "change")
|
||||||
"show balance change in each period (default)"
|
"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)"
|
"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 "
|
"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 ["tree"] (setboolopt "tree") "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 ["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"] (\opts -> setboolopt "average" opts) "show a row average column (in multicolumn reports)"
|
,flagNone ["average","A"] (setboolopt "average") "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 ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)"
|
||||||
,flagNone ["no-total","N"] (\opts -> setboolopt "no-total" opts) "omit the final total row"
|
,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)"
|
,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)"
|
,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 ["pretty-tables"] (setboolopt "pretty-tables") "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 ["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 ["budget"] (setboolopt "budget") "show performance compared to budget goals defined by periodic transactions"
|
||||||
,flagNone ["invert"] (setboolopt "invert") "display all amounts with reversed sign"
|
,flagNone ["invert"] (setboolopt "invert") "display all amounts with reversed sign"
|
||||||
,flagNone ["transpose"] (setboolopt "transpose") "transpose rows and columns"
|
,flagNone ["transpose"] (setboolopt "transpose") "transpose rows and columns"
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import Text.Printf
|
|||||||
checkdatesmode :: Mode RawOpts
|
checkdatesmode :: Mode RawOpts
|
||||||
checkdatesmode = hledgerCommandMode
|
checkdatesmode = hledgerCommandMode
|
||||||
($(embedFileRelative "Hledger/Cli/Commands/Checkdates.txt"))
|
($(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]
|
[generalflagsgroup1]
|
||||||
[]
|
[]
|
||||||
([], Just $ argsFlag "[QUERY]")
|
([], Just $ argsFlag "[QUERY]")
|
||||||
|
|||||||
@ -17,8 +17,8 @@ import Hledger.Cli.CliOptions
|
|||||||
|
|
||||||
closemode = hledgerCommandMode
|
closemode = hledgerCommandMode
|
||||||
$(embedFileRelative "Hledger/Cli/Commands/Close.txt")
|
$(embedFileRelative "Hledger/Cli/Commands/Close.txt")
|
||||||
[flagNone ["opening"] (\opts -> setboolopt "opening" opts) "show just opening transaction"
|
[flagNone ["opening"] (setboolopt "opening") "show just opening transaction"
|
||||||
,flagNone ["closing"] (\opts -> setboolopt "closing" opts) "show just closing transaction"
|
,flagNone ["closing"] (setboolopt "closing") "show just closing transaction"
|
||||||
]
|
]
|
||||||
[generalflagsgroup1]
|
[generalflagsgroup1]
|
||||||
[]
|
[]
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import Text.Printf
|
|||||||
|
|
||||||
importmode = hledgerCommandMode
|
importmode = hledgerCommandMode
|
||||||
($(embedFileRelative "Hledger/Cli/Commands/Import.txt"))
|
($(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]
|
[generalflagsgroup1]
|
||||||
[]
|
[]
|
||||||
([], Just $ argsFlag "FILE [...]")
|
([], Just $ argsFlag "FILE [...]")
|
||||||
|
|||||||
@ -29,13 +29,13 @@ import Hledger.Cli.Utils
|
|||||||
|
|
||||||
registermode = hledgerCommandMode
|
registermode = hledgerCommandMode
|
||||||
($(embedFileRelative "Hledger/Cli/Commands/Register.txt"))
|
($(embedFileRelative "Hledger/Cli/Commands/Register.txt"))
|
||||||
([flagNone ["cumulative"] (\opts -> setboolopt "change" opts)
|
([flagNone ["cumulative"] (setboolopt "change")
|
||||||
"show running total from report start date (default)"
|
"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 "
|
"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)"
|
"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"
|
,flagReq ["width","w"] (\s opts -> Right $ setopt "width" s opts) "N"
|
||||||
("set output width (default: " ++
|
("set output width (default: " ++
|
||||||
#ifdef mingw32_HOST_OS
|
#ifdef mingw32_HOST_OS
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import Hledger.Cli.CliOptions
|
|||||||
|
|
||||||
tagsmode = hledgerCommandMode
|
tagsmode = hledgerCommandMode
|
||||||
($(embedFileRelative "Hledger/Cli/Commands/Tags.txt"))
|
($(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]
|
[generalflagsgroup1]
|
||||||
[]
|
[]
|
||||||
([], Just $ argsFlag "[TAGREGEX [QUERY...]]")
|
([], Just $ argsFlag "[TAGREGEX [QUERY...]]")
|
||||||
|
|||||||
@ -84,26 +84,26 @@ compoundBalanceCommandMode :: CompoundBalanceCommandSpec -> Mode RawOpts
|
|||||||
compoundBalanceCommandMode CompoundBalanceCommandSpec{..} =
|
compoundBalanceCommandMode CompoundBalanceCommandSpec{..} =
|
||||||
hledgerCommandMode
|
hledgerCommandMode
|
||||||
cbcdoc
|
cbcdoc
|
||||||
[flagNone ["change"] (\opts -> setboolopt "change" opts)
|
[flagNone ["change"] (setboolopt "change")
|
||||||
("show balance change in each period" ++ defType PeriodChange)
|
("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)"
|
("show balance change accumulated across periods (in multicolumn reports)"
|
||||||
++ defType CumulativeChange
|
++ 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)"
|
("show historical ending balance in each period (includes postings before report start date)"
|
||||||
++ defType HistoricalBalance
|
++ 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"
|
,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 ["no-total","N"] (setboolopt "no-total") "omit the final total row"
|
||||||
,flagNone ["tree"] (\opts -> setboolopt "tree" opts) "show accounts as a tree; amounts include subaccounts (default in simple reports)"
|
,flagNone ["tree"] (setboolopt "tree") "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 ["average","A"] (setboolopt "average") "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 ["row-total","T"] (setboolopt "row-total") "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-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)"
|
,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 ["pretty-tables"] (setboolopt "pretty-tables") "use unicode when displaying tables"
|
||||||
,flagNone ["sort-amount","S"] (\opts -> setboolopt "sort-amount" opts) "sort by amount instead of account code/name"
|
,flagNone ["sort-amount","S"] (setboolopt "sort-amount") "sort by amount instead of account code/name"
|
||||||
,outputFormatFlag
|
,outputFormatFlag
|
||||||
,outputFileFlag
|
,outputFileFlag
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user