-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Command-line interface for the hledger accounting tool
--   
--   This is hledger's command-line interface. Its basic function is to
--   read a plain text file describing financial transactions and produce
--   useful reports.
--   
--   hledger is a cross-platform program for tracking money, time, or any
--   other commodity, using double-entry accounting and a simple, editable
--   file format. It is inspired by and largely compatible with ledger(1).
--   hledger provides command-line, curses and web interfaces, and aims to
--   be a reliable, practical tool for daily use.
@package hledger
@version 1.3


-- | Text.Tabular.AsciiArt from tabular-0.2.2.7, modified to treat wide
--   characters as double width.
module Text.Tabular.AsciiWide

-- | for simplicity, we assume that each cell is rendered on a single line
render :: Bool -> (rh -> String) -> (ch -> String) -> (a -> String) -> Table rh ch a -> String
verticalBar :: Bool -> Char
leftBar :: Bool -> String
rightBar :: Bool -> String
midBar :: Bool -> String
doubleMidBar :: Bool -> String
horizontalBar :: Bool -> Char
doubleHorizontalBar :: Bool -> Char

-- | We stop rendering on the shortest list!
renderColumns :: Bool -> [Int] -> Header String -> String
renderHLine :: Bool -> [Int] -> Header String -> Properties -> [String]
doubleCross :: Bool -> String
doubleVerticalCross :: Bool -> String
cross :: Bool -> Char
renderHLine' :: Bool -> Properties -> [Int] -> Char -> Header String -> String

module Hledger.Cli.Version
progname :: String
version :: String
prognameandversion :: String
prognameanddetailedversion :: String

-- | Given a program name, return a precise platform-specific executable
--   name suitable for naming downloadable binaries. Can raise an error if
--   the version and patch level was not defined correctly at build time.
binaryfilename :: String -> String


-- | Embedded documentation files in various formats, and helpers for
--   viewing them.
--   
--   |
module Hledger.Cli.DocFiles
type Topic = String
docFiles :: IsString a => [(Topic, (a, a, a))]
docTopics :: [Topic]
lookupDocNroff :: IsString a => Topic -> a
lookupDocTxt :: IsString a => Topic -> a
lookupDocInfo :: IsString a => Topic -> a
printHelpForTopic :: Topic -> IO ()
runManForTopic :: Topic -> IO ()
runInfoForTopic :: Topic -> IO ()


-- | Common cmdargs modes and flags, a command-line options type, and
--   related utilities used by hledger commands.
module Hledger.Cli.CliOptions

-- | Common help flags: --help, --debug, --version...
helpflags :: [Flag RawOpts]

-- | A hidden flag, just for the hledger executable.
detailedversionflag :: Flag RawOpts

-- | Common input-related flags: --file, --rules-file, --alias...
inputflags :: [Flag RawOpts]

-- | Common report-related flags: --period, --cost, etc.
reportflags :: [Flag RawOpts]

-- | Common output-related flags: --output-file, --output-format...
outputflags :: [Flag RawOpts]
generalflagsgroup1 :: (String, [Flag RawOpts])
generalflagsgroup2 :: (String, [Flag RawOpts])
generalflagsgroup3 :: (String, [Flag RawOpts])

-- | An empty cmdargs mode to use as a template. Modes describe the
--   top-level command, ie the program, or a subcommand, telling cmdargs
--   how to parse a command line and how to generate the command's usage
--   text.
defMode :: Mode RawOpts

-- | A cmdargs mode suitable for a hledger built-in command with the given
--   names (primary name + optional aliases). The default flags are short
--   and long help (-h and --help). The usage message shows [QUERY] as
--   argument.
defCommandMode :: [Name] -> Mode RawOpts

-- | A cmdargs mode representing the hledger add-on command with the given
--   name. Like defCommandMode, but adds a appropriate short help message
--   if the addon name is recognised, and includes hledger's common
--   input<i>reporting</i>help flags as default. Just used by hledger for
--   generating the commands list I think (or possibly for invoking the
--   addons as well ?)
quickAddonCommandMode :: Name -> Mode RawOpts

-- | Build a cmdarg mode suitable for a hledger add-on command, from a help
--   template and flag/argument specifications. Reduces boilerplate a
--   little, though the complicated cmdargs flag and argument specs are
--   still required. See the addons in bin/ for examples of usage.
hledgerCommandMode :: HelpTemplate -> [Flag RawOpts] -> [(Help, [Flag RawOpts])] -> [Flag RawOpts] -> ([Arg RawOpts], Maybe (Arg RawOpts)) -> Mode RawOpts
argsFlag :: FlagHelp -> Arg RawOpts

-- | Get a mode's usage message as a nicely wrapped string.
showModeUsage :: Mode a -> String

-- | Add command aliases to the command's help string.
withAliases :: String -> [String] -> String

-- | Command line options, used in the <tt>hledger</tt> package and above.
--   This is the "opts" used throughout hledger CLI code. representing the
--   options and arguments that were provided at startup on the
--   command-line.
data CliOpts
CliOpts :: RawOpts -> String -> [FilePath] -> Maybe FilePath -> Maybe FilePath -> Maybe String -> [String] -> Bool -> Int -> Bool -> Maybe String -> Int -> ReportOpts -> CliOpts
[rawopts_] :: CliOpts -> RawOpts
[command_] :: CliOpts -> String
[file_] :: CliOpts -> [FilePath]
[rules_file_] :: CliOpts -> Maybe FilePath
[output_file_] :: CliOpts -> Maybe FilePath
[output_format_] :: CliOpts -> Maybe String
[alias_] :: CliOpts -> [String]
[ignore_assertions_] :: CliOpts -> Bool

-- | debug level, set by <tt>--debug[=N]</tt>. See also <a>debugLevel</a>.
[debug_] :: CliOpts -> Int
[no_new_accounts_] :: CliOpts -> Bool

-- | the --width value provided, if any
[width_] :: CliOpts -> Maybe String

-- | estimated usable screen width, based on 1. the COLUMNS env var, if set
--   2. the width reported by the terminal, if supported 3. the default
--   (80)
[available_width_] :: CliOpts -> Int
[reportopts_] :: CliOpts -> ReportOpts
defcliopts :: CliOpts

-- | A helper for addon commands: this parses options and arguments from
--   the current command line using the given hledger-style cmdargs mode,
--   and returns a CliOpts. Or, with --help or -h present, it prints long
--   or short help, and exits the program. When --debug is present, also
--   prints some debug output.
--   
--   The help texts are generated from the mode. Long help includes the
--   full usage description generated by cmdargs (including all supported
--   options), framed by whatever pre- and postamble text the mode
--   specifies. It's intended that this forms a complete help document or
--   manual.
--   
--   Short help is a truncated version of the above: the preamble and the
--   first part of the usage, up to the first line containing "flags:"
--   (normally this marks the start of the common hledger flags); plus a
--   mention of --help and the (presumed supported) common hledger options
--   not displayed.
--   
--   Tips: Empty lines in the pre/postamble are removed by cmdargs; add a
--   space character to preserve them.
getHledgerCliOpts :: Mode RawOpts -> IO CliOpts

-- | Convert possibly encoded option values to regular unicode strings.
decodeRawOpts :: RawOpts -> RawOpts

-- | Parse raw option string values to the desired final data types. Any
--   relative smart dates will be converted to fixed dates based on today's
--   date. Parsing failures will raise an error. Also records the terminal
--   width, if supported.
rawOptsToCliOpts :: RawOpts -> IO CliOpts

-- | Do final validation of processed opts, raising an error if there is
--   trouble.
checkCliOpts :: CliOpts -> CliOpts
outputFormats :: [[Char]]
defaultOutputFormat :: [Char]

-- | Default line format for balance report: "%20(total)
--   %2(depth_spacer)%-(account)"
defaultBalanceLineFormat :: StringFormat

-- | Get the account name aliases from options, if any.
aliasesFromOpts :: CliOpts -> [AccountAlias]

-- | Get the (tilde-expanded, absolute) journal file path from 1. options,
--   2. an environment variable, or 3. the default. Actually, returns one
--   or more file paths. There will be more than one if multiple -f options
--   were provided. File paths can have a READER: prefix naming a
--   reader/data format.
journalFilePathFromOpts :: CliOpts -> IO [String]

-- | Get the (tilde-expanded) rules file path from options, if any.
rulesFilePathFromOpts :: CliOpts -> IO (Maybe FilePath)

-- | Get the expanded, absolute output file path from options, or the
--   default (-, meaning stdout).
outputFileFromOpts :: CliOpts -> IO FilePath

-- | Get the output format from the --output-format option, otherwise from
--   a recognised file extension in the --output-file option, otherwise the
--   default (txt).
outputFormatFromOpts :: CliOpts -> String

-- | Default width for hledger console output, when not otherwise
--   specified.
defaultWidth :: Int

-- | Get the width in characters to use for console output. This comes from
--   the --width option, or the COLUMNS environment variable, or (on posix
--   platforms) the current terminal width, or 80. Will raise a parse error
--   for a malformed --width argument.
widthFromOpts :: CliOpts -> Int

-- | Get the width in characters to use for the register command's console
--   output, and also the description column width if specified (following
--   the main width, comma-separated). The widths will be as follows: <tt>
--   no --width flag - overall width is the available width (COLUMNS, or
--   posix terminal width, or 80); description width is unspecified (auto)
--   --width W - overall width is W, description width is auto --width W,D
--   - overall width is W, description width is D </tt> Will raise a parse
--   error for a malformed --width argument.
registerWidthsFromOpts :: CliOpts -> (Int, Maybe Int)

-- | Drop leading components of accounts names as specified by --drop, but
--   only in --flat mode.
maybeAccountNameDrop :: ReportOpts -> AccountName -> AccountName

-- | Parse the format option if provided, possibly returning an error,
--   otherwise get the default value.
lineFormatFromOpts :: ReportOpts -> Either String StringFormat

-- | Get the sorted unique canonical names of hledger addon commands found
--   in the current user's PATH. These are used in command line parsing and
--   to display the commands list.
--   
--   Canonical addon names are the filenames of hledger-* executables in
--   PATH, without the "hledger-" prefix, and without the file extension
--   except when it's needed for disambiguation (see below).
--   
--   When there are exactly two versions of an executable (same base name,
--   different extensions) that look like a source and compiled pair (one
--   has .exe, .com, or no extension), the source version will be excluded
--   (even if it happens to be newer). When there are three or more
--   versions (or two versions that don't look like a source/compiled
--   pair), they are all included, with file extensions intact.
hledgerAddons :: IO [String]

-- | Get the most appropriate documentation topic for a mode. Currently,
--   that is either the hledger, hledger-ui, hledger-web or hledger-api
--   manual.
topicForMode :: Mode a -> Topic
tests_Hledger_Cli_CliOptions :: Test
instance Data.Data.Data Hledger.Cli.CliOptions.CliOpts
instance GHC.Show.Show Hledger.Cli.CliOptions.CliOpts
instance Data.Default.Class.Default Hledger.Cli.CliOptions.CliOpts


-- | The help command.
--   
--   |
module Hledger.Cli.Help
helpmode :: Mode RawOpts

-- | Print detailed help on various topics.
help' :: CliOpts -> IO ()


-- | Print a histogram report. (The "activity" command).
module Hledger.Cli.Histogram
activitymode :: Mode RawOpts
barchar :: Char

-- | Print a histogram of some statistic per report interval, such as
--   number of postings per day.
histogram :: CliOpts -> Journal -> IO ()
showHistogram :: ReportOpts -> Query -> Journal -> String
printDayWith :: (PrintfType t, PrintfArg t1) => (t2 -> t1) -> (DateSpan, t2) -> t
countBar :: Foldable t => t a -> [Char]


-- | The info command.
--   
--   |
module Hledger.Cli.Info
infomode :: Mode RawOpts

-- | Try to use info to view the selected manual.
info' :: CliOpts -> IO ()


-- | The man command.
--   
--   |
module Hledger.Cli.Man
manmode :: Mode RawOpts

-- | Try to use man to view the selected manual.
man :: CliOpts -> IO ()


-- | Utilities for top-level modules and ghci. See also Hledger.Read and
--   Hledger.Utils.
module Hledger.Cli.Utils

-- | Parse the user's specified journal file, maybe apply some
--   transformations (aliases, pivot) and run a hledger command on it, or
--   throw an error.
withJournalDo :: CliOpts -> (CliOpts -> Journal -> IO ()) -> IO ()

-- | Write some output to stdout or to a file selected by --output-file.
writeOutput :: CliOpts -> String -> IO ()

-- | Re-read the journal file(s) specified by options and maybe apply some
--   transformations (aliases, pivot), or return an error string. Reads the
--   full journal, without filtering.
journalReload :: CliOpts -> IO (Either String Journal)

-- | Re-read the option-specified journal file(s), but only if any of them
--   has changed since last read. (If the file is standard input, this will
--   either do nothing or give an error, not tested yet). Returns a journal
--   or error message, and a flag indicating whether it was re-read or not.
--   Like withJournalDo and journalReload, reads the full journal, without
--   filtering.
journalReloadIfChanged :: CliOpts -> Day -> Journal -> IO (Either String Journal, Bool)

-- | Has the journal's main data file changed since the journal was last
--   read ?
journalFileIsNewer :: Journal -> IO Bool

-- | Has the specified file (presumably one of journal's data files)
--   changed since journal was last read ?
journalSpecifiedFileIsNewer :: Journal -> FilePath -> IO Bool

-- | Get the last modified time of the specified file, or if it does not
--   exist or there is some other error, the current time.
fileModificationTime :: FilePath -> IO ClockTime

-- | Attempt to open a web browser on the given url, all platforms.
openBrowserOn :: String -> IO ExitCode

-- | Back up this file with a (incrementing) numbered suffix, then
--   overwrite it with this new text, or give an error.
writeFileWithBackup :: FilePath -> String -> IO ()

-- | Back up this file with a (incrementing) numbered suffix then overwrite
--   it with this new text, or give an error, but only if the text is
--   different from the current file contents, and return a flag indicating
--   whether we did anything.
writeFileWithBackupIfChanged :: FilePath -> Text -> IO Bool
readFileStrictly :: FilePath -> IO Text

-- | The basic structure used to create an annotated tree of test cases.
data Test :: *

-- | A set of <tt>Test</tt>s sharing the same level in the hierarchy.
TestList :: [Test] -> Test


-- | A ledger-compatible <tt>register</tt> command.
module Hledger.Cli.Register
registermode :: Mode RawOpts

-- | Print a (posting) register report.
register :: CliOpts -> Journal -> IO ()

-- | Render a register report as plain text suitable for console output.
postingsReportAsText :: CliOpts -> PostingsReport -> String

-- | Render one register report line item as plain text. Layout is like so:
--   <tt> <a>width (specified, terminal width, or 80)
--   --------------------</a> date (10) description account amount (12)
--   balance (12) DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaa
--   AAAAAAAAAAAA AAAAAAAAAAAA </tt> If description's width is specified,
--   account will use the remaining space. Otherwise, description and
--   account divide up the space equally.
--   
--   With a report interval, the layout is like so: <tt> <a>width
--   (specified, terminal width, or 80) --------------------</a> date (21)
--   account amount (12) balance (12) DDDDDDDDDDDDDDDDDDDDD
--   aaaaaaaaaaaaaaaaaaaaaaaaaaaaa AAAAAAAAAAAA AAAAAAAAAAAA </tt>
--   
--   date and description are shown for the first posting of a transaction
--   only.
--   
--   Returns a string which can be multi-line, eg if the running balance
--   has multiple commodities. Does not yet support formatting control like
--   balance reports.
postingsReportItemAsText :: CliOpts -> Int -> Int -> PostingsReportItem -> String
tests_Hledger_Cli_Register :: Test


-- | Print some statistics for the journal.
module Hledger.Cli.Stats
statsmode :: Mode RawOpts

-- | Print various statistics for the journal.
stats :: CliOpts -> Journal -> IO ()


-- | A ledger-compatible <tt>balance</tt> command, with additional support
--   for multi-column reports.
--   
--   Here is a description/specification for the balance command. See also
--   <a>Hledger.Reports</a> -&gt; "Balance reports".
--   
--   <i>Basic balance report</i>
--   
--   With no report interval (<tt>--monthly</tt> etc.), hledger's balance
--   command emulates ledger's, showing accounts indented according to
--   hierarchy, along with their total amount posted (including
--   subaccounts).
--   
--   Here's an example. With <tt>examples/sample.journal</tt>, which
--   defines the following account tree:
--   
--   <pre>
--   assets
--     bank
--       checking
--       saving
--     cash
--   expenses
--     food
--     supplies
--   income
--     gifts
--     salary
--   liabilities
--     debts
--   </pre>
--   
--   the basic <tt>balance</tt> command gives this output:
--   
--   <pre>
--    $ hledger -f sample.journal balance
--                    $-1  assets
--                     $1    bank:saving
--                    $-2    cash
--                     $2  expenses
--                     $1    food
--                     $1    supplies
--                    $-2  income
--                    $-1    gifts
--                    $-1    salary
--                     $1  liabilities:debts
--   --------------------
--                      0
--   </pre>
--   
--   Subaccounts are displayed indented below their parent. Only the
--   account leaf name (the final part) is shown. (With <tt>--flat</tt>,
--   account names are shown in full and unindented.)
--   
--   Each account's "balance" is the sum of postings in that account and
--   any subaccounts during the report period. When the report period
--   includes all transactions, this is equivalent to the account's current
--   balance.
--   
--   The overall total of the highest-level displayed accounts is shown
--   below the line. (The <tt>--no-total/-N</tt> flag prevents this.)
--   
--   <i>Eliding and omitting</i>
--   
--   Accounts which have a zero balance, and no non-zero subaccount
--   balances, are normally omitted from the report. (The
--   <tt>--empty/-E</tt> flag forces such accounts to be displayed.) Eg,
--   above <tt>checking</tt> is omitted because it has a zero balance and
--   no subaccounts.
--   
--   Accounts which have a single subaccount also being displayed, with the
--   same balance, are normally elided into the subaccount's line. (The
--   <tt>--no-elide</tt> flag prevents this.) Eg, above <tt>bank</tt> is
--   elided to <tt>bank:saving</tt> because it has only a single displayed
--   subaccount (<tt>saving</tt>) and their balance is the same ($1).
--   Similarly, <tt>liabilities</tt> is elided to
--   <tt>liabilities:debts</tt>.
--   
--   <i>Date limiting</i>
--   
--   The default report period is that of the whole journal, including all
--   known transactions. The <tt>--begin/-b</tt>, <tt>--end/-e</tt>,
--   <tt>--period/-p</tt> options or <tt>date:</tt>/<tt>date2:</tt>
--   patterns can be used to report only on transactions before and/or
--   after specified dates.
--   
--   <i>Depth limiting</i>
--   
--   The <tt>--depth</tt> option can be used to limit the depth of the
--   balance report. Eg, to see just the top level accounts (still
--   including their subaccount balances):
--   
--   <pre>
--   $ hledger -f sample.journal balance --depth 1
--                    $-1  assets
--                     $2  expenses
--                    $-2  income
--                     $1  liabilities
--   --------------------
--                      0
--   </pre>
--   
--   <i>Account limiting</i>
--   
--   With one or more account pattern arguments, the report is restricted
--   to accounts whose name matches one of the patterns, plus their parents
--   and subaccounts. Eg, adding the pattern <tt>o</tt> to the first
--   example gives:
--   
--   <pre>
--    $ hledger -f sample.journal balance o
--                     $1  expenses:food
--                    $-2  income
--                    $-1    gifts
--                    $-1    salary
--   --------------------
--                    $-1
--   </pre>
--   
--   <ul>
--   <li>The <tt>o</tt> pattern matched <tt>food</tt> and <tt>income</tt>,
--   so they are shown.</li>
--   <li><tt>food</tt>'s parent (<tt>expenses</tt>) is shown even though
--   the pattern didn't match it, to clarify the hierarchy. The usual
--   eliding rules cause it to be elided here.</li>
--   <li><tt>income</tt>'s subaccounts are also shown.</li>
--   </ul>
--   
--   <i>Multi-column balance report</i>
--   
--   hledger's balance command will show multiple columns when a reporting
--   interval is specified (eg with <tt>--monthly</tt>), one column for
--   each sub-period.
--   
--   There are three kinds of multi-column balance report, indicated by the
--   heading:
--   
--   <ul>
--   <li>A "period balance" (or "flow") report (the default) shows the
--   change of account balance in each period, which is equivalent to the
--   sum of postings in each period. Here, checking's balance increased by
--   10 in Feb:</li>
--   </ul>
--   
--   <pre>
--   Change of balance (flow):
--   
--                    Jan   Feb   Mar
--   assets:checking   20    10    -5
--   </pre>
--   
--   <ul>
--   <li>A "cumulative balance" report (with <tt>--cumulative</tt>) shows
--   the accumulated ending balance across periods, starting from zero at
--   the report's start date. Here, 30 is the sum of checking postings
--   during Jan and Feb:</li>
--   </ul>
--   
--   <pre>
--   Ending balance (cumulative):
--   
--                    Jan   Feb   Mar
--   assets:checking   20    30    25
--   </pre>
--   
--   <ul>
--   <li>A "historical balance" report (with <tt>--historical/-H</tt>) also
--   shows ending balances, but it includes the starting balance from any
--   postings before the report start date. Here, 130 is the balance from
--   all checking postings at the end of Feb, including pre-Jan postings
--   which created a starting balance of 100:</li>
--   </ul>
--   
--   <pre>
--   Ending balance (historical):
--   
--                    Jan   Feb   Mar
--   assets:checking  120   130   125
--   </pre>
--   
--   <i>Eliding and omitting, 2</i>
--   
--   Here's a (imperfect?) specification for the eliding/omitting
--   behaviour:
--   
--   <ul>
--   <li>Each account is normally displayed on its own line.</li>
--   <li>An account less deep than the report's max depth, with just one
--   interesting subaccount, and the same balance as the subaccount, is
--   non-interesting, and prefixed to the subaccount's line, unless
--   <tt>--no-elide</tt> is in effect.</li>
--   <li>An account with a zero inclusive balance and less than two
--   interesting subaccounts is not displayed at all, unless
--   <tt>--empty</tt> is in effect.</li>
--   <li>Multi-column balance reports show full account names with no
--   eliding (like <tt>--flat</tt>). Accounts (and periods) are omitted as
--   described below.</li>
--   </ul>
--   
--   <i>Which accounts to show in balance reports</i>
--   
--   By default:
--   
--   <ul>
--   <li>single-column: accounts with non-zero balance in report period.
--   (With <tt>--flat</tt>: accounts with non-zero balance and
--   postings.)</li>
--   <li>periodic: accounts with postings and non-zero period balance in
--   any period</li>
--   <li>cumulative: accounts with non-zero cumulative balance in any
--   period</li>
--   <li>historical: accounts with non-zero historical balance in any
--   period</li>
--   </ul>
--   
--   With <tt>-E/--empty</tt>:
--   
--   <ul>
--   <li>single-column: accounts with postings in report period</li>
--   <li>periodic: accounts with postings in report period</li>
--   <li>cumulative: accounts with postings in report period</li>
--   <li>historical: accounts with non-zero starting balance + accounts
--   with postings in report period</li>
--   </ul>
--   
--   <i>Which periods (columns) to show in balance reports</i>
--   
--   An empty period/column is one where no report account has any
--   postings. A zero period/column is one where no report account has a
--   non-zero period balance.
--   
--   Currently,
--   
--   by default:
--   
--   <ul>
--   <li>single-column: N/A</li>
--   <li>periodic: all periods within the overall report period, except for
--   leading and trailing empty periods</li>
--   <li>cumulative: all periods within the overall report period, except
--   for leading and trailing empty periods</li>
--   <li>historical: all periods within the overall report period, except
--   for leading and trailing empty periods</li>
--   </ul>
--   
--   With <tt>-E/--empty</tt>:
--   
--   <ul>
--   <li>single-column: N/A</li>
--   <li>periodic: all periods within the overall report period</li>
--   <li>cumulative: all periods within the overall report period</li>
--   <li>historical: all periods within the overall report period</li>
--   </ul>
--   
--   <i>What to show in empty cells</i>
--   
--   An empty periodic balance report cell is one which has no
--   corresponding postings. An empty cumulative/historical balance report
--   cell is one which has no correponding or prior postings, ie the
--   account doesn't exist yet. Currently, empty cells show 0.
module Hledger.Cli.Balance

-- | Command line options for this command.
balancemode :: Mode RawOpts

-- | The balance command, prints a balance report.
balance :: CliOpts -> Journal -> IO ()

-- | Render a single-column balance report as plain text.
balanceReportAsText :: ReportOpts -> BalanceReport -> String

-- | Render one balance report line item as plain text suitable for console
--   output (or whatever string format is specified). Note, prices will not
--   be rendered, and differently-priced quantities of the same commodity
--   will appear merged. The output will be one or more lines depending on
--   the format and number of commodities.
balanceReportItemAsText :: ReportOpts -> StringFormat -> BalanceReportItem -> [String]

-- | Render a multi-column balance report as plain text suitable for
--   console output.
multiBalanceReportAsText :: ReportOpts -> MultiBalanceReport -> String

-- | Given a table representing a multi-column balance report (for example,
--   made using <a>balanceReportAsTable</a>), render it in a format
--   suitable for console output.
renderBalanceReportTable :: ReportOpts -> Table String String MixedAmount -> String

-- | Build a <a>Table</a> from a multi-column balance report.
balanceReportAsTable :: ReportOpts -> MultiBalanceReport -> Table String String MixedAmount
tests_Hledger_Cli_Balance :: Test


-- | This module is used by the <tt>balancesheet</tt>,
--   <tt>incomestatement</tt>, and <tt>cashflow</tt> commands to print out
--   acocunt balances based on a specific "view", which consists of a title
--   and multiple named queries that are aggregated and totaled.
module Hledger.Cli.BalanceView

-- | Describes a view for the balance, which can consist of multiple
--   separate named queries that are aggregated and totaled.
data BalanceView
BalanceView :: String -> [String] -> String -> String -> [(String, Journal -> Query)] -> BalanceType -> BalanceView

-- | command line mode of the view
[bvmode] :: BalanceView -> String

-- | command line aliases
[bvaliases] :: BalanceView -> [String]

-- | command line help message
[bvhelp] :: BalanceView -> String

-- | title of the view
[bvtitle] :: BalanceView -> String

-- | named queries that make up the view
[bvqueries] :: BalanceView -> [(String, Journal -> Query)]

-- | the type of balance this view shows. This overrides user input.
[bvtype] :: BalanceView -> BalanceType
balanceviewmode :: BalanceView -> Mode RawOpts

-- | Prints out a balance report according to a given view
balanceviewReport :: BalanceView -> CliOpts -> Journal -> IO ()


-- | The <tt>balancesheet</tt> command prints a simple balance sheet.
module Hledger.Cli.Balancesheet
balancesheetmode :: Mode RawOpts
balancesheet :: CliOpts -> Journal -> IO ()
tests_Hledger_Cli_Balancesheet :: Test


-- | The <tt>cashflow</tt> command prints a simplified cashflow statement.
--   It just shows the change in all "cash" accounts for the period
--   (without the traditional segmentation into operating, investing, and
--   financing cash flows.)
module Hledger.Cli.Cashflow
cashflowmode :: Mode RawOpts
cashflow :: CliOpts -> Journal -> IO ()
tests_Hledger_Cli_Cashflow :: Test


-- | The <tt>incomestatement</tt> command prints a simple income statement
--   (profit &amp; loss) report.
module Hledger.Cli.Incomestatement
incomestatementmode :: Mode RawOpts
incomestatement :: CliOpts -> Journal -> IO ()
tests_Hledger_Cli_Incomestatement :: Test


-- | A history-aware add command to help with data entry. |
module Hledger.Cli.Add
addmode :: Mode RawOpts

-- | State used while entering transactions.
data EntryState
EntryState :: CliOpts -> [String] -> Day -> Day -> Journal -> Maybe Transaction -> [Posting] -> EntryState

-- | command line options
[esOpts] :: EntryState -> CliOpts

-- | command line arguments remaining to be used as defaults
[esArgs] :: EntryState -> [String]

-- | today's date
[esToday] :: EntryState -> Day

-- | the default date for next transaction
[esDefDate] :: EntryState -> Day

-- | the journal we are adding to
[esJournal] :: EntryState -> Journal

-- | the most similar historical txn
[esSimilarTransaction] :: EntryState -> Maybe Transaction

-- | postings entered so far in the current txn
[esPostings] :: EntryState -> [Posting]
defEntryState :: EntryState
data RestartTransactionException
RestartTransactionException :: RestartTransactionException

-- | Read multiple transactions from the console, prompting for each field,
--   and append them to the journal file. If the journal came from stdin,
--   this command has no effect.
add :: CliOpts -> Journal -> IO ()
showHelp :: IO ()

-- | Loop reading transactions from the console, prompting, validating and
--   appending each one to the journal file, until end of input or ctrl-c
--   (then raise an EOF exception). If provided, command-line arguments are
--   used as defaults; otherwise defaults come from the most similar recent
--   transaction in the journal.
getAndAddTransactions :: EntryState -> IO ()
confirmedTransactionWizard :: EntryState -> Wizard Haskeline Transaction
transactionWizard :: EntryState -> Wizard Haskeline Transaction
similarTransaction :: EntryState -> Text -> Maybe Transaction
dateAndCodeWizard :: EntryState -> Wizard Haskeline (Day, Text)
descriptionAndCommentWizard :: EntryState -> Wizard Haskeline (Text, Text)
postingsWizard :: EntryState -> Wizard Haskeline [Posting]
postingWizard :: EntryState -> Wizard Haskeline (Maybe Posting)
postingsBalanced :: [Posting] -> Bool
accountWizard :: EntryState -> Wizard Haskeline String
amountAndCommentWizard :: EntryState -> Wizard Haskeline (Amount, Text)
maybeExit :: Wizard Haskeline String -> Wizard Haskeline String
maybeRestartTransaction :: Wizard Haskeline String -> Wizard Haskeline String
dateCompleter :: String -> CompletionFunc IO
descriptionCompleter :: Journal -> String -> CompletionFunc IO
accountCompleter :: Journal -> String -> CompletionFunc IO
amountCompleter :: String -> CompletionFunc IO

-- | Generate a haskeline completion function from the given completions
--   and default, that case insensitively completes with prefix matches, or
--   infix matches above a minimum length, or completes the null string
--   with the default.
completer :: [String] -> String -> CompletionFunc IO
defaultTo' :: a -> Wizard Haskeline a -> Wizard Haskeline a
withCompletion :: (:<:) WithSettings b => CompletionFunc IO -> Wizard b a -> Wizard b a
green :: [Char] -> [Char]
showDefault :: [Char] -> [Char]

-- | Append this transaction to the journal's file and transaction list.
journalAddTransaction :: Journal -> CliOpts -> Transaction -> IO Journal

-- | Append a string, typically one or more transactions, to a journal
--   file, or if the file is "-", dump it to stdout. Tries to avoid excess
--   whitespace.
appendToJournalFileOrStdout :: FilePath -> String -> IO ()

-- | Replace a string's 0 or more terminating newlines with exactly one.
ensureOneNewlineTerminated :: String -> String

-- | Convert a string of journal data into a register report.
registerFromString :: String -> IO String
capitalize :: String -> String

-- | Find the most similar and recent transactions matching the given
--   transaction description and report query. Transactions are listed with
--   their "relevancy" score, most relevant first.
transactionsSimilarTo :: Journal -> Query -> Text -> [(Double, Transaction)]

-- | Return a similarity measure, from 0 to 1, for two transaction
--   descriptions. This is like compareStrings, but first strips out any
--   numbers, to improve accuracy eg when there are bank transaction ids
--   from imported data.
compareDescriptions :: Text -> Text -> Double

-- | Return a similarity measure, from 0 to 1, for two strings. This was
--   based on Simon White's string similarity algorithm
--   (http:/<i>www.catalysoft.com</i>articles/StrikeAMatch.html), later
--   found to be
--   <a>https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient</a>,
--   modified to handle short strings better. Todo: check out
--   <a>http://nlp.fi.muni.cz/raslan/2008/raslan08.pdf#page=14</a> .
compareStrings :: String -> String -> Double
wordLetterPairs :: String -> [[Char]]
letterPairs :: [a] -> [[a]]
instance GHC.Show.Show Hledger.Cli.Add.RestartTransactionException
instance GHC.Show.Show Hledger.Cli.Add.EntryState
instance GHC.Exception.Exception Hledger.Cli.Add.RestartTransactionException


-- | A ledger-compatible <tt>print</tt> command.
module Hledger.Cli.Print
printmode :: Mode RawOpts

-- | Print journal transactions in standard format.
print' :: CliOpts -> Journal -> IO ()
originalTransaction :: Transaction -> Transaction
tests_Hledger_Cli_Print :: Test


-- | The <tt>accounts</tt> command lists account names:
--   
--   <ul>
--   <li>in flat mode (default), it lists the full names of accounts posted
--   to by matched postings, clipped to the specified depth, possibly with
--   leading components dropped.</li>
--   <li>in tree mode, it shows the indented short names of accounts posted
--   to by matched postings, and their parents, to the specified
--   depth.</li>
--   </ul>
module Hledger.Cli.Accounts

-- | Command line options for this command.
accountsmode :: Mode RawOpts

-- | The accounts command.
accounts :: CliOpts -> Journal -> IO ()
tests_Hledger_Cli_Accounts :: Test


-- | Hledger.Cli re-exports the options, utilities and commands provided by
--   the hledger command-line program. This module also aggregates the
--   built-in unit tests defined throughout hledger and hledger-lib, and
--   adds some more which are easier to define here.
module Hledger.Cli
tests_Hledger_Cli :: Test


-- | A simple test runner for hledger's built-in unit tests.
module Hledger.Cli.Tests
testmode :: Mode RawOpts

-- | Run HUnit unit tests and exit with success or failure.
test' :: CliOpts -> IO ()


-- | hledger - a ledger-compatible accounting tool. Copyright (c) 2007-2011
--   Simon Michael <a>simon@joyful.com</a> Released under GPL version 3 or
--   later.
--   
--   hledger is a partial haskell clone of John Wiegley's "ledger". It
--   generates ledger-compatible register &amp; balance reports from a
--   plain text journal, and demonstrates a functional implementation of
--   ledger. For more information, see http://hledger.org .
--   
--   This module provides the main function for the hledger command-line
--   executable. It is exposed here so that it can be imported by eg
--   benchmark scripts.
--   
--   You can use the command line:
--   
--   <pre>
--   $ hledger --help
--   </pre>
--   
--   or ghci:
--   
--   <pre>
--   $ ghci hledger
--   &gt; j &lt;- readJournalFile Nothing Nothing True "examples/sample.journal"
--   &gt; register [] ["income","expenses"] j
--   2008/01/01 income               income:salary                   $-1          $-1
--   2008/06/01 gift                 income:gifts                    $-1          $-2
--   2008/06/03 eat &amp; shop           expenses:food                    $1          $-1
--                                   expenses:supplies                $1            0
--   &gt; balance [Depth "1"] [] l
--                    $-1  assets
--                     $2  expenses
--                    $-2  income
--                     $1  liabilities
--   &gt; l &lt;- myLedger
--   </pre>
--   
--   See <a>Hledger.Data.Ledger</a> for more examples.
module Hledger.Cli.Main

-- | The overall cmdargs mode describing command-line options for hledger.
mainmode :: [Name] -> Mode RawOpts
oldconvertmode :: Mode RawOpts
builtinCommands :: [Mode RawOpts]
builtinCommandNames :: [String]

-- | Parse hledger CLI options from these command line arguments and add-on
--   command names, or raise any error.
argsToCliOpts :: [String] -> [String] -> IO CliOpts

-- | A hacky workaround for cmdargs not accepting flags before the
--   subcommand name: try to detect and move such flags after the command.
--   This allows the user to put them in either position. The order of
--   options is not preserved, but this should be ok.
--   
--   Since we're not parsing flags as precisely as cmdargs here, this is
--   imperfect. We make a decent effort to: - move all no-argument
--   help<i>input</i>report flags - move all required-argument
--   help<i>input</i>report flags along with their values, space-separated
--   or not - not confuse things further or cause misleading errors.
moveFlagsAfterCommand :: [String] -> [String]
isMovableNoArgFlag :: [Char] -> Bool
isMovableReqArgFlag :: [Char] -> Bool
isMovableReqArgFlagAndValue :: [Char] -> Bool
isValue :: [Char] -> Bool
flagstomove :: [Flag RawOpts]
noargflagstomove :: [Name]
reqargflagstomove :: [Name]

-- | Template for the commands list. Includes an entry for known (or
--   hypothetical) builtin and addon commands; these will be filtered based
--   on the commands found at runtime. COUNT is replaced with the number of
--   commands found. OTHERCMDS is replaced with an entry for each unknown
--   addon command found. The command descriptions here should be synced
--   with the commands' builtin help and the command list in the hledger
--   manual.
commandsListTemplate :: String
knownCommands :: [String]

-- | Extract the command names from a commands list like the above: the
--   first word (or words separated by |) of lines beginning with a space.
commandsFromCommandsList :: String -> [String]

-- | Print the commands list, modifying the template above based on the
--   currently available addons. Missing addons will be removed, and extra
--   addons will be added under Misc.
printCommandsList :: [String] -> IO ()

-- | Let's go.
main :: IO ()
