Skip to content

Support pipe fallback in pivot components#2585

Open
zzhang82 wants to merge 2 commits into
simonmichael:mainfrom
zzhang82:feat-pivot-pipe-fallback
Open

Support pipe fallback in pivot components#2585
zzhang82 wants to merge 2 commits into
simonmichael:mainfrom
zzhang82:feat-pivot-pipe-fallback

Conversation

@zzhang82

Copy link
Copy Markdown

/claim #1640

Summary

  • Add | fallback within each colon-delimited --pivot component.
  • Use the first non-empty field/tag value from left to right, eg --pivot 'mynotes|desc'.
  • Preserve existing colon composition behavior, so expressions like acct:category|desc work per component.

Validation

  • Built hledger-lib and hledger from source in Docker with GHC 9.6.7 using stack --stack-yaml stack96.yaml build hledger hledger-lib.
  • Manually verified new fallback cases:
    • tag present uses tag value
    • absent tag falls back to desc
    • three-way fallback chooses first non-empty value
    • fallback works inside existing colon composition
    • all alternatives absent preserves empty-string pivot behavior
  • Manually verified existing colon composition regression:
    • --pivot acct:kind:project still produces expenses:equipment:job1, expenses:equipment:job2, and expenses:fee:job2.
  • Ran git diff --check.

@simonmichael

Copy link
Copy Markdown
Owner

Thanks for the PR. Currently this is blocked on my two latest comments on #1640.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants