From e33cce52bc818415ec93a1face88c363af597425 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sat, 14 Oct 2017 08:59:09 -0700 Subject: [PATCH] import: make --dry output valid journal format [ci skip] --- hledger/Hledger/Cli/Commands/Import.hs | 2 +- hledger/doc/commands.m4.md | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hledger/Hledger/Cli/Commands/Import.hs b/hledger/Hledger/Cli/Commands/Import.hs index 02e6b95a7..d4b3da2e4 100755 --- a/hledger/Hledger/Cli/Commands/Import.hs +++ b/hledger/Hledger/Cli/Commands/Import.hs @@ -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 diff --git a/hledger/doc/commands.m4.md b/hledger/doc/commands.m4.md index a0efe9630..ac7cba9b4 100644 --- a/hledger/doc/commands.m4.md +++ b/hledger/doc/commands.m4.md @@ -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.