Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
- module Hledger.Cli.CliOptions
- module Hledger.Cli.Commands
- module Hledger.Cli.DocFiles
- module Hledger.Cli.Utils
- module Hledger.Cli.Version
- type Help = String
- data Group a = Group {
- groupUnnamed :: [a]
- groupHidden :: [a]
- groupNamed :: [(Help, [a])]
- data Complete
- = CompleteValue String
- | CompleteFile String FilePath
- | CompleteDir String FilePath
- data Arg a = Arg {
- argValue :: Update a
- argType :: FlagHelp
- argRequire :: Bool
- data Flag a = Flag {}
- type FlagHelp = String
- data Mode a = Mode {
- modeGroupModes :: Group (Mode a)
- modeNames :: [Name]
- modeValue :: a
- modeCheck :: a -> Either String a
- modeReform :: a -> Maybe [String]
- modeExpandAt :: Bool
- modeHelp :: Help
- modeHelpSuffix :: [String]
- modeArgs :: ([Arg a], Maybe (Arg a))
- modeGroupFlags :: Group (Flag a)
- data HelpFormat
- data FlagInfo
- = FlagReq
- | FlagOpt String
- | FlagOptRare String
- | FlagNone
- class Remap (m :: Type -> Type) where
- remap :: (a -> b) -> (b -> (a, a -> b)) -> m a -> m b
- type Update a = String -> a -> Either String a
- process :: Mode a -> [String] -> Either String a
- flagNone :: [Name] -> (a -> a) -> Help -> Flag a
- flagReq :: [Name] -> Update a -> FlagHelp -> Help -> Flag a
- mode :: Name -> a -> Help -> Arg a -> [Flag a] -> Mode a
- flagOpt :: String -> [Name] -> Update a -> FlagHelp -> Help -> Flag a
- flagArg :: Update a -> FlagHelp -> Arg a
- toGroup :: [a] -> Group a
- helpText :: [String] -> HelpFormat -> Mode a -> [Text]
- expandArgsAt :: [String] -> IO [String]
- modes :: String -> a -> Help -> [Mode a] -> Mode a
- complete :: Mode a -> [String] -> (Int, Int) -> [Complete]
- joinArgs :: [String] -> String
- splitArgs :: String -> [String]
- checkMode :: Mode a -> Maybe String
- flagBool :: [Name] -> (Bool -> a -> a) -> Help -> Flag a
- fromFlagOpt :: FlagInfo -> String
- fromGroup :: Group a -> [a]
- modeEmpty :: a -> Mode a
- modeFlags :: Mode a -> [Flag a]
- modeModes :: 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
- 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
- prognameandversion :: String
- versionString :: ProgramName -> PackageVersion -> String
Documentation
module Hledger.Cli.CliOptions
module Hledger.Cli.Commands
module Hledger.Cli.DocFiles
module Hledger.Cli.Utils
module Hledger.Cli.Version
Constructors
Group | |
Fields
|
Constructors
CompleteValue String | |
CompleteFile String FilePath | |
CompleteDir String FilePath |
Instances
Show Complete | |
Eq Complete | |
Ord Complete | |
Defined in System.Console.CmdArgs.Explicit.Complete |
Constructors
Flag | |
Constructors
Mode | |
Fields
|
data HelpFormat #
Instances
Constructors
FlagReq | |
FlagOpt String | |
FlagOptRare String | |
FlagNone |
Instances
Show FlagInfo | |
Eq FlagInfo | |
Ord FlagInfo | |
Defined in System.Console.CmdArgs.Explicit.Type |
class Remap (m :: Type -> Type) where #
Instances
Remap Arg | |
Defined in System.Console.CmdArgs.Explicit.Type | |
Remap Flag | |
Defined in System.Console.CmdArgs.Explicit.Type | |
Remap Mode | |
Defined in System.Console.CmdArgs.Explicit.Type |
helpText :: [String] -> HelpFormat -> Mode a -> [Text] #
expandArgsAt :: [String] -> IO [String] #
fromFlagOpt :: FlagInfo -> String #
remapUpdate :: (a -> b) -> (b -> (a, a -> b)) -> Update a -> Update 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 #
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.