darcs patch: basic metadata support

27 views
Skip to first unread message

Xinruo Sun

unread,
Apr 8, 2012, 5:02:38 PM4/8/12
to hle...@googlegroups.com
I am working on some patches of Metadata for transactions.

Now the comments before the first posting are interpreted correctly as metadata. I don't have the need to use metadata for postings, so it is not implemented.  And I am not sure whether metadata for postings are useful.

Now metadata means key-value pairs (String,String). But ledger-cli also supports tags(:TAG:), that is only keys. It is also not implemented for now.

Filter works by specifying "tag key=value" in the patterns. Currently value cannot contains spaces.

I also updated tests/metadata.test to reflect the changes.

basic-metadata-for-transaction.dpatch

Simon Michael

unread,
Apr 9, 2012, 11:12:32 AM4/9/12
to hle...@googlegroups.com

It looks good, I have pushed to darcs. Thank you!

Best,
-Simon

John Wiegley

unread,
Apr 9, 2012, 12:08:28 AM4/9/12
to hle...@googlegroups.com
>>>>> Xinruo Sun <xiaor...@gmail.com> writes:

> I am working on some patches of Metadata for transactions. Now the comments
> before the first posting are interpreted correctly as metadata. I don't have
> the need to use metadata for postings, so it is not implemented. And I am
> not sure whether metadata for postings are useful.

How could it not be useful? Metadata on postings is pretty much the only way
I use metadata in Ledger...

John

Simon Michael

unread,
Apr 9, 2012, 6:18:36 PM4/9/12
to hle...@googlegroups.com
> I use metadata in Ledger…

Hey John! :)

Xinruo, what do you use transaction metadata for ? I'm just curious, since I haven't needed metadata yet (but I know a lot of people rely on it.)

Xinruo Sun

unread,
Apr 9, 2012, 6:37:52 PM4/9/12
to hle...@googlegroups.com
I was traveling lately. I want to note how much money I spent for each city I am visiting.

For example,

2012/4/1 hostel for two nights
    ; loc: Berlin
    expenses:travel:hotel       €40
    expenses:cash

I see in the examples of ledger documentation[1] that most metadata comes at the last line, which is attached to the last posting. If I apply it in this example, it is less interesting to attach `expenses:cash' than the other account. So here I could also attach the metadata to the first posting.

Since implementation of metadata on transaction is easier, I went for that. Maybe John could tell us some of his use cases for metadata on postings. :)

[1] http://ledger-cli.org/3.0/doc/ledger3.html#Metadata


-- You received this message because you are subscribed to the Google Groups hledger group. To post to this group, send email to hle...@googlegroups.com. To unsubscribe from this group, send email to hledger+u...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/hledger?hl=en

John Wiegley

unread,
Apr 10, 2012, 1:11:14 AM4/10/12
to hle...@googlegroups.com
>>>>> Xinruo Sun <xiaor...@gmail.com> writes:

> I was traveling lately. I want to note how much money I spent for each city
> I am visiting.

> For example,
>
> 2012/4/1 hostel for two nights
> ; loc: Berlin
> expenses:travel:hotel €40
> expenses:cash

> Since implementation of metadata on transaction is easier, I went for that.


> Maybe John could tell us some of his use cases for metadata on postings. :)

I may have this:

2012/4/1 hostel for two nights

; Location: Berlin
expenses:travel:hotel €40
; Business: Travelodge
expenses:cash

I want to associate Location with both postings, but the Business with only
the expense it relates to.

John

Reply all
Reply to author
Forward
0 new messages