| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Options.Applicative.Builder.Extra
Description
Extra functions for optparse-applicative.
Synopsis
- boolFlags :: Bool -> String -> String -> Mod FlagFields Bool -> Parser Bool
- boolFlagsNoDefault :: String -> String -> Mod FlagFields Bool -> Parser Bool
- firstBoolFlagsNoDefault :: String -> String -> Mod FlagFields (Maybe Bool) -> Parser (First Bool)
- firstBoolFlagsTrue :: String -> String -> Mod FlagFields FirstTrue -> Parser FirstTrue
- firstBoolFlagsFalse :: String -> String -> Mod FlagFields FirstFalse -> Parser FirstFalse
- enableDisableFlags :: a -> a -> a -> String -> String -> Mod FlagFields a -> Parser a
- enableDisableFlagsNoDefault :: a -> a -> String -> String -> Mod FlagFields a -> Parser a
- extraHelpOption :: Bool -> String -> String -> String -> Parser (a -> a)
- execExtraHelp :: [String] -> String -> Parser a -> String -> IO ()
- textOption :: Mod OptionFields Text -> Parser Text
- textArgument :: Mod ArgumentFields Text -> Parser Text
- optionalFirst :: Alternative f => f a -> f (First a)
- optionalFirstTrue :: Alternative f => f Bool -> f FirstTrue
- optionalFirstFalse :: Alternative f => f Bool -> f FirstFalse
- absFileOption :: Mod OptionFields (Path Abs File) -> Parser (Path Abs File)
- relFileOption :: Mod OptionFields (Path Rel File) -> Parser (Path Rel File)
- absDirOption :: Mod OptionFields (Path Abs Dir) -> Parser (Path Abs Dir)
- relDirOption :: Mod OptionFields (Path Rel Dir) -> Parser (Path Rel Dir)
- eitherReader' :: Show e => (String -> Either e a) -> ReadM a
- fileCompleter :: Completer
- fileExtCompleter :: [String] -> Completer
- dirCompleter :: Completer
- data PathCompleterOpts = PathCompleterOpts {
- pcoAbsolute :: Bool
- pcoRelative :: Bool
- pcoRootDir :: Maybe FilePath
- pcoFileFilter :: FilePath -> Bool
- pcoDirFilter :: FilePath -> Bool
- defaultPathCompleterOpts :: PathCompleterOpts
- pathCompleterWith :: PathCompleterOpts -> Completer
- unescapeBashArg :: String -> String
- showHelpText :: ParseError
Documentation
Arguments
| :: Bool | Default value |
| -> String | Flag name |
| -> String | Help suffix |
| -> Mod FlagFields Bool | |
| -> Parser Bool |
Enable/disable flags for a Bool.
firstBoolFlagsNoDefault :: String -> String -> Mod FlagFields (Maybe Bool) -> Parser (First Bool) Source #
Flag with no default of True or False
firstBoolFlagsTrue :: String -> String -> Mod FlagFields FirstTrue -> Parser FirstTrue Source #
Flag with a Semigroup instance and a default of True
firstBoolFlagsFalse :: String -> String -> Mod FlagFields FirstFalse -> Parser FirstFalse Source #
Flag with a Semigroup instance and a default of False
Arguments
| :: a | Default value |
| -> a | Enabled value |
| -> a | Disabled value |
| -> String | Name |
| -> String | Help suffix |
| -> Mod FlagFields a | |
| -> Parser a |
Enable/disable flags for any type.
enableDisableFlagsNoDefault Source #
Arguments
| :: a | Enabled value |
| -> a | Disabled value |
| -> String | Name |
| -> String | Help suffix |
| -> Mod FlagFields a | |
| -> Parser a |
Enable/disable flags for any type, without a default (to allow chaining with <|>)
Arguments
| :: Bool | Hide from the brief description? |
| -> String | Program name, e.g. |
| -> String | Option glob expression, e.g. |
| -> String | Help option name, e.g. |
| -> Parser (a -> a) |
Show an extra help option (e.g. --docker-help shows help for all
--docker* args).
To actually have that help appear, use execExtraHelp before executing the
main parser.
Arguments
| :: [String] | Command line arguments |
| -> String | Extra help option name, e.g. |
| -> Parser a | Option parser for the relevant command |
| -> String | Option description |
| -> IO () |
Display extra help if extra help option passed in arguments.
Since optparse-applicative doesn't allow an arbitrary IO action for an
abortOption, this was the best way I found that doesn't require manually
formatting the help.
textOption :: Mod OptionFields Text -> Parser Text Source #
textArgument :: Mod ArgumentFields Text -> Parser Text Source #
optionalFirst :: Alternative f => f a -> f (First a) Source #
optionalFirstTrue :: Alternative f => f Bool -> f FirstTrue Source #
optionalFirstFalse :: Alternative f => f Bool -> f FirstFalse Source #
Like optional, but returning a FirstFalse.
eitherReader' :: Show e => (String -> Either e a) -> ReadM a Source #
Like eitherReader, but accepting any on the Show eLeft.
fileExtCompleter :: [String] -> Completer Source #
data PathCompleterOpts Source #
Constructors
| PathCompleterOpts | |
Fields
| |
unescapeBashArg :: String -> String Source #