simplify config flag display

This commit is contained in:
Simon Michael 2009-01-20 06:05:37 +00:00
parent 8dcd53c9ba
commit 56c99bdfd6

View File

@ -13,32 +13,18 @@ import Ledger.Dates
configflags = [ configflags = [
("vty",
#ifdef VTY #ifdef VTY
True "vty"
#else
False
#endif #endif
)
,("ansi",
#ifdef ANSI #ifdef ANSI
True ,"ansi"
#else
False
#endif #endif
) ]
]
versionmsg = "hledger " ++ version ++ configmsg ++ "\n" versionmsg = "hledger " ++ version ++ configmsg ++ "\n"
version = "0.3.x" version = "0.3.x"
configmsg configmsg = if null configflags
| null with && null without = "" then ""
| (not $ null with) && (not $ null without) = " configured" ++ with ++ " and" ++ without else " with " ++ intercalate ", " configflags
| otherwise = " configured" ++ with ++ without
where
with = punc "with" [f | (f,v) <- configflags, v]
without = punc "without" [f | (f,v) <- configflags, not v]
punc _ [] = ""
punc prefix ws = printf " %s %s" prefix (intercalate ", " ws)
ledgerdefault = "~/.ledger" ledgerdefault = "~/.ledger"
ledgerenvvar = "LEDGER" ledgerenvvar = "LEDGER"
timelogdefault = "~/.timelog" timelogdefault = "~/.timelog"