Skip to content

Commit 144489a

Browse files
committed
imp: setup: improve output
1 parent f0f0483 commit 144489a

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

hledger/Hledger/Cli/Commands/Setup.hs

+8-16
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ setupJournal meconf = do
333333

334334
pdesc "a default journal file is readable ?"
335335
jfile <- defaultJournalPath
336-
337336
-- let
338337
-- args = concat [
339338
-- ["print"],
@@ -344,7 +343,7 @@ setupJournal meconf = do
344343
-- XXX can this ignore assertions and config files, like the above ?
345344
ej <- defaultJournalSafely
346345
case ej of
347-
Left e -> p N (jfile <> ":\n" <> show e)
346+
Left estr -> p N (jfile <> ":\n" <> estr)
348347
Right j@Journal{..} -> do
349348
p Y jfile
350349

@@ -418,25 +417,18 @@ setupJournal meconf = do
418417
then p Y (concatMap show accttypes)
419418
else p N (concatMap show typesnotfound <> "not found; type: queries, bs/cf/is reports may not work")
420419

421-
pdesc "balance assertions are checked ?"
422-
let
423-
ignoreassertions = isJust $ conflookup (\a -> any (==a) ["-I", "--ignore-assertions"])
424-
strict = isJust $ conflookup (\a -> any (==a) ["-s", "--strict"])
425-
if
426-
| ignoreassertions && not strict -> i N "use -s to check assertions"
427-
| not strict -> i Y "use -I to ignore assertions"
428-
| otherwise -> i Y "can't ignore assertions (-s in config file)"
429-
430420
pdesc "commodities/accounts are checked ?"
421+
let strict = isJust $ conflookup (\a -> any (==a) ["-s", "--strict"])
431422
if strict
432423
then i Y "commodities and accounts must be declared"
433424
else i N "use -s to check commodities/accounts"
434425

435-
------------------------------------------------------------------------------
436-
437-
-- setupX = do
438-
-- pgroup "x"
439-
-- pdesc "x ?"
426+
pdesc "balance assertions are checked ?"
427+
let ignoreassertions = isJust $ conflookup (\a -> any (==a) ["-I", "--ignore-assertions"])
428+
if
429+
| ignoreassertions && not strict -> i N "use -s to check assertions"
430+
| not strict -> i Y "use -I to ignore assertions"
431+
| otherwise -> i Y "can't ignore assertions (-s in config file)"
440432

441433
------------------------------------------------------------------------------
442434

0 commit comments

Comments
 (0)