From 810c6a5dac44c06f710e46b31e153711ac4413b3 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Wed, 19 Jan 2011 18:55:16 +0000 Subject: [PATCH] print: don't show a trailing space when description is blank --- hledger-lib/Hledger/Data/Transaction.hs | 4 ++-- tests/amount-layout-vertical.test | 2 +- tests/cleared-marker.test | 2 +- tests/include.test | 8 ++++---- tests/metadata.test | 2 +- tests/precision.test | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hledger-lib/Hledger/Data/Transaction.hs b/hledger-lib/Hledger/Data/Transaction.hs index 4220cb359..d4934aa3c 100644 --- a/hledger-lib/Hledger/Data/Transaction.hs +++ b/hledger-lib/Hledger/Data/Transaction.hs @@ -72,8 +72,8 @@ showTransaction' elide effective t = | otherwise = showdate (tdate t) ++ maybe "" showedate (teffectivedate t) status = if tstatus t then " *" else "" code = if length (tcode t) > 0 then printf " (%s)" $ tcode t else "" - desc = ' ' : tdescription t - comment = if null com then "" else " ; " ++ com where com = tcomment t + desc = if null d then "" else " " ++ d where d = tdescription t + comment = if null c then "" else " ; " ++ c where c = tcomment t showdate = printf "%-10s" . showDate showedate = printf "=%s" . showdate showpostings ps diff --git a/tests/amount-layout-vertical.test b/tests/amount-layout-vertical.test index 6202d2349..7be26bb89 100644 --- a/tests/amount-layout-vertical.test +++ b/tests/amount-layout-vertical.test @@ -7,7 +7,7 @@ bin/hledger -f - print b USD 1 ; a dollar c ; a euro and a dollar >>> -2010/01/01 +2010/01/01 a EUR 1 ; a euro b USD 1 ; a dollar EUR -1 diff --git a/tests/cleared-marker.test b/tests/cleared-marker.test index 650eb9450..bc649231a 100644 --- a/tests/cleared-marker.test +++ b/tests/cleared-marker.test @@ -18,7 +18,7 @@ bin/hledger -f- print --cleared a 1 b -1 -2010/01/03 * +2010/01/03 * a 1 b -1 diff --git a/tests/include.test b/tests/include.test index 5729b79c4..8502d3435 100644 --- a/tests/include.test +++ b/tests/include.test @@ -1,16 +1,16 @@ # nested includes in subdirectories mkdir -p b/c/d ; printf '2010/1/1\n (D) 1\n' >b/c/d/d.journal ; printf '2010/1/1\n (C) 1\n!include d/d.journal\n' >b/c/c.journal ; printf '2010/1/1\n (B) 1\n!include c/c.journal\n' >b/b.journal ; printf '2010/1/1\n (A) 1\n!include b/b.journal\n' >a.journal ; bin/hledger -f a.journal print; rm -rf a.journal b >>> -2010/01/01 +2010/01/01 (A) 1 -2010/01/01 +2010/01/01 (B) 1 -2010/01/01 +2010/01/01 (C) 1 -2010/01/01 +2010/01/01 (D) 1 >>>2 diff --git a/tests/metadata.test b/tests/metadata.test index 2d8444dbb..fcbb1b908 100644 --- a/tests/metadata.test +++ b/tests/metadata.test @@ -12,7 +12,7 @@ bin/hledger -f - print ; posting2data1: ; posting2nonmetadata: >>> -2010/01/01 +2010/01/01 a 1 b -1 diff --git a/tests/precision.test b/tests/precision.test index dd0537f77..e9e1efce1 100644 --- a/tests/precision.test +++ b/tests/precision.test @@ -9,7 +9,7 @@ bin/hledger -f - print --cost a 1C @ $1.0049 a >>> -2010/01/01 +2010/01/01 a 0 a $1.00 a $-1.00 @@ -25,7 +25,7 @@ bin/hledger -f - print a 1C @ $1.0049 a >>> -2010/01/01 +2010/01/01 a 0 a 1C @ $1.0049 a -1C @ $1.0049