Skip to content

[💰20$ bounty] Inconsistent alignment for currencies with long names #1148

Open
@nobodyinperson

Description

@nobodyinperson

Hi!

Situation

I am using hledger for inventory/asset management in my research project. It works great to keep track of where categories of things are and to a degree even for tracking individual objects (via identifying tags). The best solution for my application turned out to be quoted long currency names for types of things (better readability and searchability via cur:'.*keyword.*').

Problem

However, hledger balance seems to have a hard-coded (minimum?) currency column width which works fine for short currencies (like USD or EUR) and otherwise calculate the currency indentation per-account. This leads to weird indentations and breaks the nice accounts tree view. I didn't find anything concerning this in the online documentation.

Example

Cooked-up example journal test.hledger:

2019/12/09 Outdoor
    [room:workshop]      5 "80 watt solar panel" @@ 500.00 EUR
    [room:workshop]      1 "rugged outdoor laptop" @@ 1000.00 EUR
    [store]

2019/12/09 Car
    [room:garage]     4 "car tires" @@ 300.00 EUR
    [store]
lsb_release -a
# Distributor ID:	Ubuntu
# Description:	Ubuntu 18.04.3 LTS
# Release:	18.04
# Codename:	bionic
# docker image https://hub.docker.com/r/dastapov/hledger
hledger --version
# hledger 1.16.1
hledger -f test.hledger balance
#   5 "80 watt solar panel"
#             4 "car tires"
# 1 "rugged outdoor laptop"  room
#        4 "car tires"    garage
#   5 "80 watt solar panel"
# 1 "rugged outdoor laptop"    workshop
#         -1800.00 EUR  store
# --------------------
#   5 "80 watt solar panel"
#              -1800.00 EUR
#             4 "car tires"
# 1 "rugged outdoor laptop"

I'd rather expect an output like this (all currencies indented like in the total summary):

hledger -f test.hledger balance
#   5 "80 watt solar panel"
#             4 "car tires"
# 1 "rugged outdoor laptop"  room
#             4 "car tires"    garage
#   5 "80 watt solar panel"
# 1 "rugged outdoor laptop"    workshop
#              -1800.00 EUR  store
# --------------------
#   5 "80 watt solar panel"
#              -1800.00 EUR
#             4 "car tires"
# 1 "rugged outdoor laptop"

Solution

For example:

  • calculating the longest currency name in advance and using that as a currency column size
  • let user specify a forced currency column width via command-line flag

PS: hledger is really awesome!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-WISHSome kind of improvement request or proposal.balance

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions