import: make --dry output valid journal format

[ci skip]
This commit is contained in:
Simon Michael 2017-10-14 08:59:09 -07:00
parent 08acad3f42
commit e33cce52bc
2 changed files with 7 additions and 1 deletions

View File

@ -51,7 +51,7 @@ importcmd opts@CliOpts{rawopts_=rawopts,inputopts_=iopts} j = do
case sortBy (comparing tdate) $ jtxns newj of
[] -> putStrLn "no new transactions"
newts | dryrun -> do
printf "would import %d new transactions:\n\n" (length newts)
printf "; would import %d new transactions:\n\n" (length newts)
-- TODO how to force output here ?
-- length (jtxns newj) `seq` print' opts{rawopts_=("explicit",""):rawopts} newj
mapM_ (putStr . showTransactionUnelided) newts

View File

@ -409,6 +409,12 @@ New transactions are detected in the same way as print --new:
by assuming transactions are always added to the input files in increasing date order,
and by saving `.latest.FILE` state files.
The --dry-run output is in journal format, so you can filter it, eg
to see only uncategorised transactions:
```shell
$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions
```
## incomestatement
Show an income statement. Alias: is.