any way for "hledger close" to add a tag to the entry?

23 views
Skip to first unread message

Will Robinson

unread,
Jan 2, 2024, 2:01:07 PMJan 2
to hle...@googlegroups.com
I want to do something similar to the "clopen" tagging mentioned in the help, but within a script where I'm automating the run of "hledger close" to generate closing balances, retain earnings, etc.

Can "hledger close" add a tag to its output ledger entry?

--
Will Robinson (willro...@gmail.com)

Simon Michael

unread,
Jan 2, 2024, 2:54:55 PMJan 2
to hledger


> On Jan 2, 2024, at 09:00, Will Robinson <willro...@gmail.com> wrote:
>
> I want to do something similar to the "clopen" tagging mentioned in the help, but within a script where I'm automating the run of "hledger close" to generate closing balances, retain earnings, etc.
>
> Can "hledger close" add a tag to its output ledger entry?
>

Not really. You could add a posting with a tag using auto posting rules, but simpler to add it outside of hledger with awk maybe.

the.so...@gmail.com

unread,
Feb 4, 2024, 5:45:03 AMFeb 4
to hledger
You could abuse the `--close-desc` option with an argument that includes the tag.
E.g.:

$ hledger close --retain '^Income' --close-acct="Equity:Retained:Income:FY22-23" --close-desc="FY2022-23 Closing Balances  ; tag:clopen" --explicit date:2022-04..2023-04 >> /tmp/fy2022-23.journal

~ Pranesh

Simon Michael

unread,
Feb 4, 2024, 6:03:16 AMFeb 4
to hledger
Ah yes! I should have thought of that.



--
You received this message because you are subscribed to the Google Groups "hledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hledger+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hledger/274bdf01-5b3f-4fa1-8236-302f0fc9b462n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages