hledger-1.27.1: Command-line interface for the hledger accounting system
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hledger.Cli

Description

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.

Synopsis

Documentation

data Mode a #

Constructors

Mode 

Fields

Instances

Instances details
Remap Mode 
Instance details

Defined in System.Console.CmdArgs.Explicit.Type

Methods

remap :: (a -> b) -> (b -> (a, a -> b)) -> Mode a -> Mode b #

flagHelpFormat :: (HelpFormat -> TextFormat -> a -> a) -> Flag a #

flagHelpSimple :: (a -> a) -> Flag a #

flagNumericVersion :: (a -> a) -> Flag a #

flagVersion :: (a -> a) -> Flag a #

flagsVerbosity :: (Verbosity -> a -> a) -> [Flag a] #

processArgs :: Mode a -> IO a #

processValue :: Mode a -> [String] -> a #

processValueIO :: Mode a -> [String] -> IO a #

complete :: Mode a -> [String] -> (Int, Int) -> [Complete] #

expandArgsAt :: [String] -> IO [String] #

helpText :: [String] -> HelpFormat -> Mode a -> [Text] #

process :: Mode a -> [String] -> Either String a #

joinArgs :: [String] -> String #

splitArgs :: String -> [String] #

checkMode :: Mode a -> Maybe String #

flagArg :: Update a -> FlagHelp -> Arg a #

flagBool :: [Name] -> (Bool -> a -> a) -> Help -> Flag a #

flagNone :: [Name] -> (a -> a) -> Help -> Flag a #

flagOpt :: String -> [Name] -> Update a -> FlagHelp -> Help -> Flag a #

flagReq :: [Name] -> Update a -> FlagHelp -> Help -> Flag a #

fromFlagOpt :: FlagInfo -> String #

fromGroup :: Group a -> [a] #

mode :: Name -> a -> Help -> Arg a -> [Flag a] -> Mode a #

modeEmpty :: a -> Mode a #

modeFlags :: Mode a -> [Flag a] #

modeModes :: Mode a -> [Mode a] #

modes :: String -> a -> Help -> [Mode a] -> Mode a #

parseBool :: String -> Maybe Bool #

remap2 :: Remap m => (a -> b) -> (b -> a) -> m a -> m b #

remapUpdate :: (a -> b) -> (b -> (a, a -> b)) -> Update a -> Update b #

toGroup :: [a] -> Group a #

data Complete #

Constructors

CompleteValue String 
CompleteFile String FilePath 
CompleteDir String FilePath 

Instances

Instances details
Show Complete 
Instance details

Defined in System.Console.CmdArgs.Explicit.Complete

Methods

showsPrec :: Int -> Complete -> ShowS

show :: Complete -> String

showList :: [Complete] -> ShowS

Eq Complete 
Instance details

Defined in System.Console.CmdArgs.Explicit.Complete

Methods

(==) :: Complete -> Complete -> Bool

(/=) :: Complete -> Complete -> Bool

Ord Complete 
Instance details

Defined in System.Console.CmdArgs.Explicit.Complete

Methods

compare :: Complete -> Complete -> Ordering

(<) :: Complete -> Complete -> Bool

(<=) :: Complete -> Complete -> Bool

(>) :: Complete -> Complete -> Bool

(>=) :: Complete -> Complete -> Bool

max :: Complete -> Complete -> Complete

min :: Complete -> Complete -> Complete

data HelpFormat #

Instances

Instances details
Bounded HelpFormat 
Instance details

Defined in System.Console.CmdArgs.Explicit.Help

Enum HelpFormat 
Instance details

Defined in System.Console.CmdArgs.Explicit.Help

Read HelpFormat 
Instance details

Defined in System.Console.CmdArgs.Explicit.Help

Methods

readsPrec :: Int -> ReadS HelpFormat

readList :: ReadS [HelpFormat]

readPrec :: ReadPrec HelpFormat

readListPrec :: ReadPrec [HelpFormat]

Show HelpFormat 
Instance details

Defined in System.Console.CmdArgs.Explicit.Help

Methods

showsPrec :: Int -> HelpFormat -> ShowS

show :: HelpFormat -> String

showList :: [HelpFormat] -> ShowS

Default HelpFormat 
Instance details

Defined in System.Console.CmdArgs.Explicit.Help

Methods

def :: HelpFormat

Eq HelpFormat 
Instance details

Defined in System.Console.CmdArgs.Explicit.Help

Methods

(==) :: HelpFormat -> HelpFormat -> Bool

(/=) :: HelpFormat -> HelpFormat -> Bool

Ord HelpFormat 
Instance details

Defined in System.Console.CmdArgs.Explicit.Help

data Arg a #

Constructors

Arg 

Fields

Instances

Instances details
Remap Arg 
Instance details

Defined in System.Console.CmdArgs.Explicit.Type

Methods

remap :: (a -> b) -> (b -> (a, a -> b)) -> Arg a -> Arg b #

data Flag a #

Constructors

Flag 

Instances

Instances details
Remap Flag 
Instance details

Defined in System.Console.CmdArgs.Explicit.Type

Methods

remap :: (a -> b) -> (b -> (a, a -> b)) -> Flag a -> Flag b #

type FlagHelp = String #

data FlagInfo #

Constructors

FlagReq 
FlagOpt String 
FlagOptRare String 
FlagNone 

Instances

Instances details
Show FlagInfo 
Instance details

Defined in System.Console.CmdArgs.Explicit.Type

Methods

showsPrec :: Int -> FlagInfo -> ShowS

show :: FlagInfo -> String

showList :: [FlagInfo] -> ShowS

Eq FlagInfo 
Instance details

Defined in System.Console.CmdArgs.Explicit.Type

Methods

(==) :: FlagInfo -> FlagInfo -> Bool

(/=) :: FlagInfo -> FlagInfo -> Bool

Ord FlagInfo 
Instance details

Defined in System.Console.CmdArgs.Explicit.Type

Methods

compare :: FlagInfo -> FlagInfo -> Ordering

(<) :: FlagInfo -> FlagInfo -> Bool

(<=) :: FlagInfo -> FlagInfo -> Bool

(>) :: FlagInfo -> FlagInfo -> Bool

(>=) :: FlagInfo -> FlagInfo -> Bool

max :: FlagInfo -> FlagInfo -> FlagInfo

min :: FlagInfo -> FlagInfo -> FlagInfo

data Group a #

Constructors

Group 

Fields

Instances

Instances details
Functor Group 
Instance details

Defined in System.Console.CmdArgs.Explicit.Type

Methods

fmap :: (a -> b) -> Group a -> Group b

(<$) :: a -> Group b -> Group a

Monoid (Group a) 
Instance details

Defined in System.Console.CmdArgs.Explicit.Type

Methods

mempty :: Group a

mappend :: Group a -> Group a -> Group a

mconcat :: [Group a] -> Group a

Semigroup (Group a) 
Instance details

Defined in System.Console.CmdArgs.Explicit.Type

Methods

(<>) :: Group a -> Group a -> Group a

sconcat :: NonEmpty (Group a) -> Group a

stimes :: Integral b => b -> Group a -> Group a

Show a => Show (Group a) 
Instance details

Defined in System.Console.CmdArgs.Explicit.Type

Methods

showsPrec :: Int -> Group a -> ShowS

show :: Group a -> String

showList :: [Group a] -> ShowS

type Help = String #

class Remap (m :: TYPE LiftedRep -> Type) where #

Methods

remap :: (a -> b) -> (b -> (a, a -> b)) -> m a -> m b #

Instances

Instances details
Remap Arg 
Instance details

Defined in System.Console.CmdArgs.Explicit.Type

Methods

remap :: (a -> b) -> (b -> (a, a -> b)) -> Arg a -> Arg b #

Remap Flag 
Instance details

Defined in System.Console.CmdArgs.Explicit.Type

Methods

remap :: (a -> b) -> (b -> (a, a -> b)) -> Flag a -> Flag b #

Remap Mode 
Instance details

Defined in System.Console.CmdArgs.Explicit.Type

Methods

remap :: (a -> b) -> (b -> (a, a -> b)) -> Mode a -> Mode b #

type Update a = String -> a -> Either String a #

prognameandversion :: String Source #

The program name and version string for this build of the hledger tool, including any git info available at build time.

versionString :: ProgramName -> PackageVersion -> String Source #

A helper to generate the best version string we can from the given program name and package version strings, current os and architecture, and any git info available at build time (commit hash, commit date, branch name, patchlevel since latest release tag for that program's package). Typically called for programs "hledger", "hledger-ui", or "hledger-web".

The git info changes whenever any file in the repository changes. Keeping this template haskell call here and not down in Hledger.Cli.Version helps reduce the number of modules recompiled.