| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Hledger.Cli.Commands
Description
hledger's built-in commands, and helpers for printing the commands list.
New built-in commands should be added in four places below: the export list, the import list, builtinCommands, commandsListSections.
Synopsis
- commands :: CliOpts -> Journal -> IO ()
- mainmode :: [Name] -> Mode RawOpts
- runUnitTests :: String -> IO ()
- builtinCommands :: [(Mode RawOpts, CliOpts -> Journal -> IO ())]
- builtinCommandNames :: [String]
- addonCommandNames :: IO [String]
- knownAddonCommandNames :: [String]
- findBuiltinCommand :: String -> Maybe (Mode RawOpts, CliOpts -> Journal -> IO ())
- knownCommands :: [String]
- data CommandCategories = CommandCategories {
- showbuiltins_ :: Bool
- showaddons_ :: Bool
- showaliases_ :: Bool
- commandCategories :: RawOpts -> CommandCategories
- printCommandsList :: CommandCategories -> [String] -> [(CommandAlias, CommandLine)] -> IO ()
- tests_Hledger_Cli :: TestTree
- module Hledger.Cli.Commands.Accounts
- module Hledger.Cli.Commands.Activity
- module Hledger.Cli.Commands.Add
- module Hledger.Cli.Commands.Aregister
- module Hledger.Cli.Commands.Balance
- module Hledger.Cli.Commands.Balancesheet
- module Hledger.Cli.Commands.Balancesheetequity
- module Hledger.Cli.Commands.Cashflow
- module Hledger.Cli.Commands.Check
- module Hledger.Cli.Commands.Close
- module Hledger.Cli.Commands.Codes
- module Hledger.Cli.Commands.Commodities
- module Hledger.Cli.Commands.Descriptions
- module Hledger.Cli.Commands.Diff
- module Hledger.Cli.Commands.Files
- module Hledger.Cli.Commands.Get
- module Hledger.Cli.Commands.Help
- module Hledger.Cli.Commands.Holdings
- module Hledger.Cli.Commands.Import
- module Hledger.Cli.Commands.Incomestatement
- module Hledger.Cli.Commands.Init
- module Hledger.Cli.Commands.Notes
- module Hledger.Cli.Commands.Payees
- module Hledger.Cli.Commands.Prices
- module Hledger.Cli.Commands.Print
- module Hledger.Cli.Commands.Register
- module Hledger.Cli.Commands.Rewrite
- module Hledger.Cli.Commands.Roi
- module Hledger.Cli.Commands.Run
- module Hledger.Cli.Commands.Setup
- module Hledger.Cli.Commands.Stats
- module Hledger.Cli.Commands.Tags
- module Hledger.Cli.Commands.Transactions
Documentation
commands :: CliOpts -> Journal -> IO () Source #
Display the commands list, limited to the categories selected by --builtins--addons--aliases. Only the selected categories are looked up: the addons in PATH, and the command aliases in the config file.
mainmode :: [Name] -> Mode RawOpts Source #
The overall cmdargs mode describing hledger's command-line options and subcommands. The names of known addons are provided so they too can be recognised as commands.
runUnitTests :: String -> IO () Source #
Run the hledger and hledger-lib packages' unit tests (for --test), or just those whose names match the given tasty pattern, if it is non-empty. Defined here for easy access to other modules' tests. They run in a single thread: they take only milliseconds, and running them in parallel occasionally crashes or hangs on aarch64 macOS, apparently from a GHC runtime bug (seen with GHC 9.12 and 9.14; https://gitlab.haskell.org/ghc/ghc/-/issues/28001).
builtinCommands :: [(Mode RawOpts, CliOpts -> Journal -> IO ())] Source #
The cmdargs subcommand mode (for command-line parsing) and IO action (for doing the command's work) for each builtin command. Command actions take parsed CLI options and a (lazy) finalised journal.
builtinCommandNames :: [String] Source #
All names and aliases of the builtin commands.
addonCommandNames :: IO [String] Source #
knownAddonCommandNames :: [String] Source #
Canonical names of the known addon commands which have a slot in the commands list, in alphabetical order.
findBuiltinCommand :: String -> Maybe (Mode RawOpts, CliOpts -> Journal -> IO ()) Source #
Look up a builtin command's mode and action by exact command name or alias.
knownCommands :: [String] Source #
Canonical names of all commands which have a slot in the commands list, in alphabetical order. These include the builtin commands and the known addon commands.
data CommandCategories Source #
The three categories of command which the commands list can show: the commands built in to hledger, the addon commands installed in PATH, and the command aliases defined in the config file.
Constructors
| CommandCategories | |
Fields
| |
commandCategories :: RawOpts -> CommandCategories Source #
Which command categories are selected by the --builtins, --addons and --aliases flags in these options. Each of those flags limits the commands list to one category; with none of them, all categories are shown.
printCommandsList :: CommandCategories -> [String] -> [(CommandAlias, CommandLine)] -> IO () Source #
Print the commands list, with a pager if appropriate: the selected categories of command, customised with the addons installed in PATH and the command aliases defined in the config file.
module Hledger.Cli.Commands.Add
module Hledger.Cli.Commands.Balance
module Hledger.Cli.Commands.Check
module Hledger.Cli.Commands.Close
module Hledger.Cli.Commands.Codes
module Hledger.Cli.Commands.Diff
module Hledger.Cli.Commands.Files
module Hledger.Cli.Commands.Get
module Hledger.Cli.Commands.Help
module Hledger.Cli.Commands.Import
module Hledger.Cli.Commands.Init
module Hledger.Cli.Commands.Notes
module Hledger.Cli.Commands.Payees
module Hledger.Cli.Commands.Prices
module Hledger.Cli.Commands.Print
module Hledger.Cli.Commands.Rewrite
module Hledger.Cli.Commands.Roi
module Hledger.Cli.Commands.Run
module Hledger.Cli.Commands.Setup
module Hledger.Cli.Commands.Stats
module Hledger.Cli.Commands.Tags