Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: CSV rule negation #2088

Merged
merged 1 commit into from
Oct 5, 2023
Merged

Conversation

bobobo1618
Copy link
Contributor

I'm interested in hledger but really need #2054 for my use-case (certain locations for the same store fit in one purchase category, other locations in another).

I don't know a whole lot of Haskell but hopefully enough to make myself dangerous. I think this change works? The tests I added seem to pass?

@simonmichael simonmichael merged commit 9fb5740 into simonmichael:master Oct 5, 2023
1 check passed
@simonmichael
Copy link
Owner

Sorry for the delay @bobobo1618 . A valuable feature! In my excitement I forgot to ask for documentation. Could you suggest some wording and I'll add it.

@simonmichael simonmichael added the csv The csv file format, csv output format, or generally CSV-related. label Oct 5, 2023
@bobobo1618
Copy link
Contributor Author

I had a look at the existing matcher documentation and would suggest "When a matcher is preceded by an exclamation mark (!), the matcher will be negated; only lines that don't match the original matcher will be matched."

@simonmichael
Copy link
Owner

Perfect. Thank you!

simonmichael added a commit that referenced this pull request Oct 9, 2023
@simonmichael
Copy link
Owner

Howdy @bobobo1618 . I tried to use ! in CSV rules for the first time, in an AND-ed condition, like this:

# stripe transfers where amount is positive
if STRIPE TRANSFER
& ! %amount -

but couldn't make it work. Would you have time to check this case and show a working example, or add a test and fix ?

@bobobo1618
Copy link
Contributor Author

Howdy @bobobo1618 . I tried to use ! in CSV rules for the first time, in an AND-ed condition, like this:

# stripe transfers where amount is positive
if STRIPE TRANSFER
& ! %amount -

but couldn't make it work. Would you have time to check this case and show a working example, or add a test and fix ?

I'd love to but I'm afraid this is beyond my Haskell abilities. Right now the logic only supports a simple prefix but this feature would require some kind of recursive logical structure and I'm not familiar enough with how to make that work.

@simonmichael
Copy link
Owner

Mentioned this limitation in the manual for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
csv The csv file format, csv output format, or generally CSV-related.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants