    {-# LANGUAGE TemplateHaskell #-}

    module Hledger.Cli.Commands.Printunique (
      printuniquemode
     ,printunique
    )
    where

    import Data.List.Extra (nubSortOn)
    import Hledger
    import Hledger.Cli.CliOptions
    import Hledger.Cli.Commands.Print

    printuniquemode :: Mode RawOpts
    printuniquemode = CommandDoc
    -> [Flag RawOpts]
    -> [(CommandDoc, [Flag RawOpts])]
    -> [Flag RawOpts]
    -> ([Arg RawOpts], Maybe (Arg RawOpts))
    -> Mode RawOpts
    hledgerCommandMode
      $(embedFileRelative "Hledger/Cli/Commands/Printunique.txt")
      []
      [(CommandDoc, [Flag RawOpts])
    generalflagsgroup1]
      [Flag RawOpts]
    hiddenflags
      ([], Maybe (Arg RawOpts)
    forall a. Maybe a
    Nothing)

    printunique :: CliOpts -> Journal -> IO ()
    printunique opts :: CliOpts
    opts j :: Journal
    j@Journal{jtxns :: Journal -> [Transaction]
    jtxns=[Transaction]
    ts} = do
      CliOpts -> Journal -> IO ()
    print' CliOpts
    opts Journal
    j{jtxns :: [Transaction]
    jtxns=[Transaction] -> [Transaction]
    uniquify [Transaction]
    ts}
      where
        uniquify :: [Transaction] -> [Transaction]
    uniquify = (Transaction -> Text) -> [Transaction] -> [Transaction]
    forall b a. Ord b => (a -> b) -> [a] -> [a]
    nubSortOn Transaction -> Text
    thingToCompare
        thingToCompare :: Transaction -> Text
    thingToCompare = Transaction -> Text
    tdescription
        -- thingToCompare = tdate