payees: Add a module for handling payees command
This commit is contained in:
parent
a45b42bed5
commit
e6b709cb01
@ -32,6 +32,7 @@ module Hledger.Cli.Commands (
|
|||||||
,module Hledger.Cli.Commands.Help
|
,module Hledger.Cli.Commands.Help
|
||||||
,module Hledger.Cli.Commands.Import
|
,module Hledger.Cli.Commands.Import
|
||||||
,module Hledger.Cli.Commands.Incomestatement
|
,module Hledger.Cli.Commands.Incomestatement
|
||||||
|
,module Hledger.Cli.Commands.Payees
|
||||||
,module Hledger.Cli.Commands.Prices
|
,module Hledger.Cli.Commands.Prices
|
||||||
,module Hledger.Cli.Commands.Print
|
,module Hledger.Cli.Commands.Print
|
||||||
,module Hledger.Cli.Commands.Printunique
|
,module Hledger.Cli.Commands.Printunique
|
||||||
@ -75,6 +76,7 @@ import Hledger.Cli.Commands.Files
|
|||||||
import Hledger.Cli.Commands.Help
|
import Hledger.Cli.Commands.Help
|
||||||
import Hledger.Cli.Commands.Import
|
import Hledger.Cli.Commands.Import
|
||||||
import Hledger.Cli.Commands.Incomestatement
|
import Hledger.Cli.Commands.Incomestatement
|
||||||
|
import Hledger.Cli.Commands.Payees
|
||||||
import Hledger.Cli.Commands.Prices
|
import Hledger.Cli.Commands.Prices
|
||||||
import Hledger.Cli.Commands.Print
|
import Hledger.Cli.Commands.Print
|
||||||
import Hledger.Cli.Commands.Printunique
|
import Hledger.Cli.Commands.Printunique
|
||||||
@ -107,6 +109,7 @@ builtinCommands = [
|
|||||||
,(filesmode , files)
|
,(filesmode , files)
|
||||||
,(diffmode , diff)
|
,(diffmode , diff)
|
||||||
,(incomestatementmode , incomestatement)
|
,(incomestatementmode , incomestatement)
|
||||||
|
,(payeesmode , payees)
|
||||||
,(pricesmode , prices)
|
,(pricesmode , prices)
|
||||||
,(printmode , print')
|
,(printmode , print')
|
||||||
,(printuniquemode , printunique)
|
,(printuniquemode , printunique)
|
||||||
@ -173,6 +176,7 @@ commandsList = unlines [
|
|||||||
," balance (b, bal) show balance changes/end balances/budgets in accounts"
|
," balance (b, bal) show balance changes/end balances/budgets in accounts"
|
||||||
," commodities show commodity/currency symbols"
|
," commodities show commodity/currency symbols"
|
||||||
," files show input file paths"
|
," files show input file paths"
|
||||||
|
," payees show payees"
|
||||||
," prices show market price records"
|
," prices show market price records"
|
||||||
," print (p, txns) show transactions (journal entries)"
|
," print (p, txns) show transactions (journal entries)"
|
||||||
," print-unique show only transactions with unique descriptions"
|
," print-unique show only transactions with unique descriptions"
|
||||||
|
|||||||
47
hledger/Hledger/Cli/Commands/Payees.hs
Normal file
47
hledger/Hledger/Cli/Commands/Payees.hs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
{-|
|
||||||
|
|
||||||
|
The @payees@ command lists payees:
|
||||||
|
|
||||||
|
- with the notes option the note field is included along with payees
|
||||||
|
|
||||||
|
-}
|
||||||
|
|
||||||
|
{-# LANGUAGE MultiWayIf #-}
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
|
|
||||||
|
module Hledger.Cli.Commands.Payees (
|
||||||
|
payeesmode
|
||||||
|
,payees
|
||||||
|
) where
|
||||||
|
|
||||||
|
#if !(MIN_VERSION_base(4,11,0))
|
||||||
|
import Data.Monoid
|
||||||
|
#endif
|
||||||
|
import Data.List
|
||||||
|
import qualified Data.Text as T
|
||||||
|
import qualified Data.Text.IO as T
|
||||||
|
import System.Console.CmdArgs.Explicit as C
|
||||||
|
|
||||||
|
import Hledger
|
||||||
|
import Hledger.Cli.CliOptions
|
||||||
|
|
||||||
|
|
||||||
|
-- | Command line options for this command.
|
||||||
|
payeesmode = hledgerCommandMode
|
||||||
|
$(embedFileRelative "Hledger/Cli/Commands/Payees.txt")
|
||||||
|
[flagNone ["notes"] (setboolopt "notes") "include note field with payees"
|
||||||
|
]
|
||||||
|
[generalflagsgroup1]
|
||||||
|
hiddenflags
|
||||||
|
([], Just $ argsFlag "[QUERY]")
|
||||||
|
|
||||||
|
-- | The payees command.
|
||||||
|
payees :: CliOpts -> Journal -> IO ()
|
||||||
|
payees CliOpts{rawopts_=rawopts, reportopts_=ropts} j = do
|
||||||
|
let notes = notes_ ropts
|
||||||
|
payees = []
|
||||||
|
|
||||||
|
mapM_ (T.putStrLn . render) payees
|
||||||
15
hledger/Hledger/Cli/Commands/Payees.md
Normal file
15
hledger/Hledger/Cli/Commands/Payees.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
payees
|
||||||
|
Show payee names.
|
||||||
|
|
||||||
|
_FLAGS_
|
||||||
|
|
||||||
|
This command lists all payee names that appear in transactions. With the optional notes directive (`--notes`) it will include the note field along with the base payee name.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ hledger payees
|
||||||
|
Store Name
|
||||||
|
Gas Station
|
||||||
|
Person A
|
||||||
|
```
|
||||||
15
hledger/Hledger/Cli/Commands/Payees.txt
Normal file
15
hledger/Hledger/Cli/Commands/Payees.txt
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
payees
|
||||||
|
Show payee names.
|
||||||
|
|
||||||
|
_FLAGS_
|
||||||
|
|
||||||
|
This command lists all payee names that appear in transactions. With the
|
||||||
|
optional notes directive (--notes) it will include the note field along
|
||||||
|
with the base payee name.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
$ hledger payees
|
||||||
|
Store Name
|
||||||
|
Gas Station
|
||||||
|
Person A
|
||||||
@ -77,6 +77,7 @@ extra-source-files:
|
|||||||
Hledger/Cli/Commands/Help.txt
|
Hledger/Cli/Commands/Help.txt
|
||||||
Hledger/Cli/Commands/Import.txt
|
Hledger/Cli/Commands/Import.txt
|
||||||
Hledger/Cli/Commands/Incomestatement.txt
|
Hledger/Cli/Commands/Incomestatement.txt
|
||||||
|
Hledger/Cli/Commands/Payees.txt
|
||||||
Hledger/Cli/Commands/Prices.txt
|
Hledger/Cli/Commands/Prices.txt
|
||||||
Hledger/Cli/Commands/Print.txt
|
Hledger/Cli/Commands/Print.txt
|
||||||
Hledger/Cli/Commands/Printunique.txt
|
Hledger/Cli/Commands/Printunique.txt
|
||||||
@ -127,6 +128,7 @@ library
|
|||||||
Hledger.Cli.Commands.Files
|
Hledger.Cli.Commands.Files
|
||||||
Hledger.Cli.Commands.Import
|
Hledger.Cli.Commands.Import
|
||||||
Hledger.Cli.Commands.Incomestatement
|
Hledger.Cli.Commands.Incomestatement
|
||||||
|
Hledger.Cli.Commands.Payees
|
||||||
Hledger.Cli.Commands.Prices
|
Hledger.Cli.Commands.Prices
|
||||||
Hledger.Cli.Commands.Print
|
Hledger.Cli.Commands.Print
|
||||||
Hledger.Cli.Commands.Printunique
|
Hledger.Cli.Commands.Printunique
|
||||||
|
|||||||
@ -70,6 +70,7 @@ extra-source-files:
|
|||||||
- Hledger/Cli/Commands/Help.txt
|
- Hledger/Cli/Commands/Help.txt
|
||||||
- Hledger/Cli/Commands/Import.txt
|
- Hledger/Cli/Commands/Import.txt
|
||||||
- Hledger/Cli/Commands/Incomestatement.txt
|
- Hledger/Cli/Commands/Incomestatement.txt
|
||||||
|
- Hledger/Cli/Commands/Payees.txt
|
||||||
- Hledger/Cli/Commands/Prices.txt
|
- Hledger/Cli/Commands/Prices.txt
|
||||||
- Hledger/Cli/Commands/Print.txt
|
- Hledger/Cli/Commands/Print.txt
|
||||||
- Hledger/Cli/Commands/Printunique.txt
|
- Hledger/Cli/Commands/Printunique.txt
|
||||||
@ -172,6 +173,7 @@ library:
|
|||||||
- Hledger.Cli.Commands.Files
|
- Hledger.Cli.Commands.Files
|
||||||
- Hledger.Cli.Commands.Import
|
- Hledger.Cli.Commands.Import
|
||||||
- Hledger.Cli.Commands.Incomestatement
|
- Hledger.Cli.Commands.Incomestatement
|
||||||
|
- Hledger.Cli.Commands.Payees
|
||||||
- Hledger.Cli.Commands.Prices
|
- Hledger.Cli.Commands.Prices
|
||||||
- Hledger.Cli.Commands.Print
|
- Hledger.Cli.Commands.Print
|
||||||
- Hledger.Cli.Commands.Printunique
|
- Hledger.Cli.Commands.Printunique
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user