Re: How do I check for tags without value?

2023-05-26 Thread crea.24...@gmail.com
...or maybe not. I was a bit quick there. It did not find tags without 
value, but it found tags *without* exactly one character (which was all my 
tags).
After a bit of fiddling I got it to work as I intended. After adding posts 
for some hours, the brain fog began to set in ;-).

But this seems to work if I add this to each account definition I check the 
tag on:

account Foo
note The foo account
alias bar
check has_tag('baz')
check tag("baz") !~ /^$/

fredag 26 maj 2023 kl. 16:46:02 UTC+2 skrev crea.24...@gmail.com:

> Yes, it works. Thanks, Martin.
> I found 19 lines with missing tag values in the first file I tried it on. 
> If the tag is missing a value the pivot doesn't show the correct value.
> I use the tags with --pivot  on an account. Instead of adding 
> more accounts, just add a tag and use --pivot. 
>
> If I use it when I declare an account or a tag (check), I don't have to 
> remember to add it on the command line.
>
> fredag 26 maj 2023 kl. 10:56:40 UTC+2 skrev Martin Michlmayr:
>
>> * crea.24...@gmail.com  [2023-05-26 01:14]:
>> > This works fine if you check for a specific tag value, but it doesn't 
>> work 
>> > if you want to check for a tag without a value. check value != "" ,or 
>> check 
>> > value != '' or a similar regex don't raise any warnings.
>> > 
>> > Is there a way to check if a tag has no value?
>>
>> This works for me:
>>
>> -l 'has_tag("foo")' -l 'tag("foo") !~ /./'
>>
>> -- 
>> Martin Michlmayr
>> https://www.cyrius.com/
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/110cdec5-0a70-44a0-a981-342e7c155d49n%40googlegroups.com.


Re: How do I check for tags without value?

2023-05-26 Thread crea.24...@gmail.com
Yes, it works. Thanks, Martin.
I found 19 lines with missing tag values in the first file I tried it on. 
If the tag is missing a value the pivot doesn't show the correct value.
I use the tags with --pivot  on an account. Instead of adding 
more accounts, just add a tag and use --pivot. 

If I use it when I declare an account or a tag (check), I don't have to 
remember to add it on the command line.

fredag 26 maj 2023 kl. 10:56:40 UTC+2 skrev Martin Michlmayr:

> * crea.24...@gmail.com  [2023-05-26 01:14]:
> > This works fine if you check for a specific tag value, but it doesn't 
> work 
> > if you want to check for a tag without a value. check value != "" ,or 
> check 
> > value != '' or a similar regex don't raise any warnings.
> > 
> > Is there a way to check if a tag has no value?
>
> This works for me:
>
> -l 'has_tag("foo")' -l 'tag("foo") !~ /./'
>
> -- 
> Martin Michlmayr
> https://www.cyrius.com/
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/98b3cdbf-53bd-409b-a5f8-e5902f81b2b6n%40googlegroups.com.


Re: How do I check for tags without value?

2023-05-26 Thread Martin Michlmayr
* crea.24...@gmail.com  [2023-05-26 01:14]:
> This works fine if you check for a specific tag value, but it doesn't work 
> if you want to check for a tag without a value. check value != "" ,or check 
> value != '' or a similar regex don't raise any warnings.
> 
> Is there a way to check if a tag has no value?

This works for me:

-l 'has_tag("foo")' -l 'tag("foo") !~ /./'

-- 
Martin Michlmayr
https://www.cyrius.com/

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/20230526085637.GA524428%40jirafa.cyrius.com.


How do I check for tags without value?

2023-05-26 Thread crea.24...@gmail.com
If you declare tags and accounts using the --strict flag, you can add 
different checks in the account and tag declaration. I'm using check 
has_tag('tag-name') in the account declaration, and check value [== | =~] 
some_value in the tag declaration.

This works fine if you check for a specific tag value, but it doesn't work 
if you want to check for a tag without a value. check value != "" ,or check 
value != '' or a similar regex don't raise any warnings.

Is there a way to check if a tag has no value?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/ad4faffe-fbcd-4a33-b65b-a5a38360a80bn%40googlegroups.com.