bs/cf/is: show one trailing blank line, not two

This commit is contained in:
Simon Michael 2017-07-25 12:43:56 -07:00
parent 11202c897a
commit 9d4d6ebc4d
5 changed files with 12 additions and 20 deletions

View File

@ -480,8 +480,7 @@ multiBalanceReportAsCsv opts (MultiBalanceReport (colspans, items, (coltotals,to
-- | Render a multi-column balance report as plain text suitable for console output. -- | Render a multi-column balance report as plain text suitable for console output.
multiBalanceReportAsText :: ReportOpts -> MultiBalanceReport -> String multiBalanceReportAsText :: ReportOpts -> MultiBalanceReport -> String
multiBalanceReportAsText opts r = multiBalanceReportAsText opts r =
printf "%s in %s:" typeStr (showDateSpan $ multiBalanceReportSpan r) printf "%s in %s:\n\n" typeStr (showDateSpan $ multiBalanceReportSpan r)
++ "\n"
++ renderBalanceReportTable opts tabl ++ renderBalanceReportTable opts tabl
where where
tabl = balanceReportAsTable opts r tabl = balanceReportAsTable opts r
@ -495,11 +494,16 @@ multiBalanceReportAsText opts r =
-- made using 'balanceReportAsTable'), render it in a format suitable for -- made using 'balanceReportAsTable'), render it in a format suitable for
-- console output. -- console output.
renderBalanceReportTable :: ReportOpts -> Table String String MixedAmount -> String renderBalanceReportTable :: ReportOpts -> Table String String MixedAmount -> String
renderBalanceReportTable (ReportOpts { pretty_tables_ = pretty, color_=usecolor }) = unlines . trimborder . lines renderBalanceReportTable (ReportOpts { pretty_tables_ = pretty, color_=usecolor }) =
. render pretty id (" " ++) showamt unlines
. align . addtrailingblank
. trimborder
. lines
. render pretty id (" " ++) showamt
. align
where where
trimborder = ("":) . (++[""]) . drop 1 . init . map (drop 1 . init) addtrailingblank = (++[""])
trimborder = drop 1 . init . map (drop 1 . init)
align (Table l t d) = Table l' t d align (Table l t d) = Table l' t d
where where
acctswidth = maximum' $ map strWidth (headerContents l) acctswidth = maximum' $ map strWidth (headerContents l)

View File

@ -155,8 +155,8 @@ compoundBalanceCommand CompoundBalanceCommandSpec{..} CliOpts{command_=cmd, repo
++ (if average_ ropts' then [overallaverage] else []) ++ (if average_ ropts' then [overallaverage] else [])
where where
overallaverage = overalltotal `divideMixedAmount` fromIntegral (length overalltotals) overallaverage = overalltotal `divideMixedAmount` fromIntegral (length overalltotals)
putStrLn title putStrLn $ title ++ "\n"
putStrLn $ renderBalanceReportTable ropts' overalltable' putStr $ renderBalanceReportTable ropts' overalltable'
-- Add the second table below the first, discarding its column headings. -- Add the second table below the first, discarding its column headings.
concatTables (Table hLeft hTop dat) (Table hLeft' _ dat') = concatTables (Table hLeft hTop dat) (Table hLeft' _ dat') =

View File

@ -45,7 +45,6 @@ Balance Sheet
======================++================================================================================================================================================= ======================++=================================================================================================================================================
Total || $1 $1 $1 $1 $1 0 0 0 0 0 0 0 Total || $1 $1 $1 $1 $1 0 0 0 0 0 0 0
>>>=0 >>>=0
# 3. # 3.
@ -74,7 +73,6 @@ Balance Sheet
==============++================================================================================================================================================= ==============++=================================================================================================================================================
Total || $1 $1 $1 $1 $1 0 0 0 0 0 0 0 Total || $1 $1 $1 $1 $1 0 0 0 0 0 0 0
>>>= 0 >>>= 0
# 4. # 4.
@ -100,7 +98,6 @@ Balance Sheet
======================++========================================================================================================================================================== ======================++==========================================================================================================================================================
Total || $1 $1 $1 $1 $1 0 0 0 0 0 0 0 0 Total || $1 $1 $1 $1 $1 0 0 0 0 0 0 0 0
>>>= 0 >>>= 0
# 5. # 5.
@ -124,7 +121,6 @@ Balance Sheet
----------------------++---------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------++----------------------------------------------------------------------------------------------------------------------------------------------------------
|| 0 0 0 0 0 0 0 0 0 0 0 $1 $1 || 0 0 0 0 0 0 0 0 0 0 0 $1 $1
>>>= 0 >>>= 0
# 6. Tree output still works, #565 # 6. Tree output still works, #565
@ -197,7 +193,6 @@ Balance Sheet
=============++=============================== =============++===============================
Total || $1 $1 $1 Total || $1 $1 $1
>>>2 >>>2
>>>=0 >>>=0
@ -225,6 +220,5 @@ Balance Sheet
═════════════╬═════════════ ═════════════╬═════════════
Total ║ 1 Total ║ 1
>>>2 >>>2
>>>= 0 >>>= 0

View File

@ -161,7 +161,6 @@ Cashflow Statement
----------------------++------------------------------------------------------------------------------------------------------------- ----------------------++-------------------------------------------------------------------------------------------------------------
|| $1 0 0 0 0 $-1 0 0 0 0 0 $-1 || $1 0 0 0 0 $-1 0 0 0 0 0 $-1
>>>= 0 >>>= 0
# 7. Multicolumn test (historical) # 7. Multicolumn test (historical)
@ -179,7 +178,6 @@ Cashflow Statement (Historical Ending Balances)
----------------------++---------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------++----------------------------------------------------------------------------------------------------------------------------------------------------------
|| $1 $1 $1 $1 $1 0 0 0 0 0 0 $-1 0 || $1 $1 $1 $1 $1 0 0 0 0 0 0 $-1 0
>>>= 0 >>>= 0
# 8. without -N/--no-total (single column) # 8. without -N/--no-total (single column)
@ -224,7 +222,6 @@ Cashflow Statement
--------------------++------- --------------------++-------
|| $-1 || $-1
>>>2 >>>2
>>>= 0 >>>= 0
@ -240,6 +237,5 @@ Cashflow Statement
assets:bank:saving || $1 assets:bank:saving || $1
assets:cash || $-2 assets:cash || $-2
>>>2 >>>2
>>>= 0 >>>= 0

View File

@ -208,7 +208,6 @@ Income Statement
===================++=============================================================================================================================== ===================++===============================================================================================================================
Total || $-1 0 0 0 0 $1 0 0 0 0 0 0 0 0 Total || $-1 0 0 0 0 $1 0 0 0 0 0 0 0 0
>>>= 0 >>>= 0
# 6. Multicolumn test (historical) # 6. Multicolumn test (historical)
@ -234,5 +233,4 @@ Income Statement (Historical Ending Balances)
===================++================================================================================================================================================= ===================++=================================================================================================================================================
Total || $-1 $-1 $-1 $-1 $-1 0 0 0 0 0 0 0 Total || $-1 $-1 $-1 $-1 $-1 0 0 0 0 0 0 0
>>>= 0 >>>= 0