Skip to content

Commodity exchange (-X, --exchange) does not work properly for quoted commodities #2321

@charly-089

Description

@charly-089

Commodity exchange (-X, --exchange) does not work properly for commodities that have a quoted name.

Example file:

commodity N1
commodity N2
	value s, d, t -> market(2 "N1", d, t)
commodity N3
	value s, d, t -> market(2 "N2", d, t)
commodity N4
	value s, d, t -> market(2 "N3", d, t)

2024-01-05 Buy
	Assets	1 "N4"
	Equity

-X option seems to work properly only for N1 and N4. I am not able to get a register with commodities N2 or N3.

$ ledger --columns 40 --output - -f file -X 'N4'
24-Jan-05 Buy      Assets    1 N4   1 N4
                   Equity   -1 N4      0

$ ledger --columns 40 --output - -f file -X 'N3'
24-Jan-05 Buy      Assets    8 N1   8 N1
                   Equity   -8 N1      0

$ ledger --columns 40 --output - -f file -X 'N2'
24-Jan-05 Buy      Assets    8 N1   8 N1
                   Equity   -8 N1      0

$ ledger --columns 40 --output - -f file -X 'N1'
24-Jan-05 Buy      Assets    8 N1   8 N1
                   Equity   -8 N1      0

For commodities that only contain letters, this works fine. I already tried some types of quoting and escaping like -X '"N2"', -X '\"N2\"' and -X '"\"N2\""', but I only got a register report for N1.

Is this possibly a bug? If yes, does anyone know a workaround?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions