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

Merge hledger-diff as a cli command #981

Merged
merged 1 commit into from Mar 4, 2019

Conversation

Projects
None yet
2 participants
@gebner
Copy link
Collaborator

gebner commented Mar 3, 2019

This PR merges the external hledger-diff tool. See gebner/hledger-diff#8

I hope I've got the Diff.txt and Diff.md files right.

@simonmichael
Copy link
Owner

simonmichael left a comment

Thanks! Could you add to the commit message that this is merging your addon package http://hackage.haskell.org/package/hledger-diff, which is now deprecated.

Compares two journal files. It looks at the transactions of a single
account and prints out the transactions which are in one journal file but not
in the other. This is particularly useful for reconciling existing journals
with bank statements.

This comment has been minimized.

@simonmichael

simonmichael Mar 3, 2019

Owner

This motivating use case is helpful. Could you add a little more concrete detail here ? Eg do you convert a chunk of CSV between the dates of two bank statements to a journal file, and then diff that with your main file ?

@@ -0,0 +1,19 @@
diff

This comment has been minimized.

@simonmichael

simonmichael Mar 3, 2019

Owner

./Shake commandhelp is the intended way to generate this file, maybe you did that already. If there's any differences I can fix.

This comment has been minimized.

@gebner

gebner Mar 4, 2019

Author Collaborator

Ok, ./Shake commandhelp fails for me:

pandoc -f markdown-smart-tex_math_dollars hledger/Hledger/Cli/Commands/Balancesheetequity.md --lua-filter tools/pandoc-dedent-code-blocks.lua -t plain > hledger/Hledger/Cli/Commands/Balancesheetequity.txt
Error running filter tools/pandoc-dedent-code-blocks.lua:
tools/pandoc-dedent-code-blocks.lua: openBinaryFile: does not exist (No such file or directory)
Error when running Shake build system:
  at src/Development/Shake/Internal/Args.hs:81:69-79:
* Depends on: commandhelp
  at Shake.hs:443:27-43:
* Depends on: hledger/Hledger/Cli/Commands/Balancesheetequity.txt
* Raised the exception:
user error (Development.Shake.cmd, system command failed
Command: /bin/sh -c 'pandoc -f markdown-smart-tex_math_dollars hledger/Hledger/Cli/Commands/Balancesheetequity.md --lua-filter tools/pandoc-dedent-code-blocks.lua -t plain > hledger/Hledger/Cli/Commands/Balancesheetequity.txt'
Exit code: 83
Stderr:
Error running filter tools/pandoc-dedent-code-blocks.lua:
tools/pandoc-dedent-code-blocks.lua: openBinaryFile: does not exist (No such file or directory)
)


simonmichael added a commit that referenced this pull request Mar 4, 2019

@simonmichael

This comment has been minimized.

Copy link
Owner

simonmichael commented Mar 4, 2019

@simonmichael
Copy link
Owner

simonmichael left a comment

You haven't yet updated the commit message but I can do that. I'll probably also squash to keep the history clean. Will do soon.

same name in both files), and only checks the amount of the postings (not the
name or the date of the transactions). Postings are compared (instead of
transactions) so that you can combine multiple transactions from the bank
statement in a single transaction in the ledger file.

This comment has been minimized.

@simonmichael

simonmichael Mar 4, 2019

Owner

Useful extra detail, thanks. We might tweak the wording some day to make it more generally applicable - I've not yet personally encountered a bank that exports separate "statements", instead I tend to see CSV between two arbitrary dates within the last N months.

cli: add diff command
This merges the external hledger-diff addon, which is now deprecated.
https://github.com/gebner/hledger-diff/

@gebner gebner force-pushed the gebner:hledger-diff branch from d8cc11e to ff57fb5 Mar 4, 2019

@gebner

This comment has been minimized.

Copy link
Collaborator Author

gebner commented Mar 4, 2019

Squashed, rebased, and successfully regenerated the .txt file. I also added the comment to the commit message.

I'll also the deprecation notice to the hledger-diff readme when the next hledger version is released.

Side note: after regenerating the command help files, I now have a new file that is not committed to git, hledger/Hledger/Cli/Commands/README.txt.

simonmichael added a commit that referenced this pull request Mar 4, 2019

@simonmichael simonmichael merged commit ceb193f into simonmichael:master Mar 4, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@simonmichael

This comment has been minimized.

Copy link
Owner

simonmichael commented Mar 4, 2019

Lovely! Thanks @gebner. I've fixed the README.txt.

simonmichael added a commit that referenced this pull request Mar 4, 2019

simonmichael added a commit that referenced this pull request Mar 4, 2019

@simonmichael

This comment has been minimized.

Copy link
Owner

simonmichael commented Mar 4, 2019

A few more little tweaks and snags I noticed:

$ hledger diff
Specifiy exactly two journal files

Fix typo, be just a little more verbose/polite for consistent tone. "Please specify exactly two journal files with -f, eg hledger diff -f FILE1 -f FILE2" or something ?

$ hledger diff -h
diff [OPTIONS] [ACCOUNT] -f [JOURNAL1] -f [JOURNAL2]

Should be -f JOURNAL1 -f JOURNAL2 (no brackets). Or maybe -f FILE1 -f FILE2 since they might not be in journal format (also consistent with the above).

The [ACCOUNT] indeed is optional, but I think the command doesn't do anything without it so perhaps it shouldn't be ? And maybe I'd put it after the -f options, more consistent with other helps.

simonmichael added a commit that referenced this pull request Mar 7, 2019

simonmichael added a commit that referenced this pull request Mar 7, 2019

simonmichael added a commit that referenced this pull request Mar 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.