print: don't show a trailing space when description is blank

This commit is contained in:
Simon Michael 2011-01-19 18:55:16 +00:00
parent 8980dd9336
commit 810c6a5dac
6 changed files with 11 additions and 11 deletions

View File

@ -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

View File

@ -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

View File

@ -18,7 +18,7 @@ bin/hledger -f- print --cleared
a 1
b -1
2010/01/03 *
2010/01/03 *
a 1
b -1

View File

@ -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

View File

@ -12,7 +12,7 @@ bin/hledger -f - print
; posting2data1:
; posting2nonmetadata:
>>>
2010/01/01
2010/01/01
a 1
b -1

View File

@ -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