print --match: show --match's argument in debug output

If you forget that the argument is required by the --match
option, and not the command as a whole - eg if instead of

  hledger print --match somebank -x

you write:

  hledger print --match -x somebank

that gets quietly parsed as:

  hledger print --match="-x"

which is not great. Adding --debug now at least gives some insight:

  hledger print --match -x somebank --debug
  finding best match for description: "-x"
  similar transactions:
  ...
This commit is contained in:
Simon Michael 2021-02-20 14:16:33 -08:00
parent 5e7c4fc7bc
commit f4d81377af

View File

@ -62,7 +62,7 @@ print' opts j = do
let j' = journalMapPostingAmounts amountSetFullPrecision j let j' = journalMapPostingAmounts amountSetFullPrecision j
case maybestringopt "match" $ rawopts_ opts of case maybestringopt "match" $ rawopts_ opts of
Nothing -> printEntries opts j' Nothing -> printEntries opts j'
Just desc -> printMatch opts j' $ T.pack desc Just desc -> printMatch opts j' $ T.pack $ dbg1 "finding best match for description" desc
printEntries :: CliOpts -> Journal -> IO () printEntries :: CliOpts -> Journal -> IO ()
printEntries opts@CliOpts{reportspec_=rspec} j = printEntries opts@CliOpts{reportspec_=rspec} j =