registry-options-0.2.0.0: application options parsing
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.Registry.Options.Parsers

Description

Common parsers for options

  • option specifies a named value on the command line
  • flag specifies a value derived from the presence of the flag
  • named specifies a value derived from the name of a flag
  • switch specifies a flag with a boolean value
  • argument specifies a value not delimited by an option name, the first string value is parsed
  • positional specifies an argument which is expected to be at a specific place in the list of arguments
Synopsis

Documentation

option :: forall s a. (KnownSymbol s, Typeable a, Show a) => OptionDescriptionUpdates -> Registry _ _ Source #

Create an option: - with a short/long name - a metavar - no active/default values

The OptionDescriptionUpdates list can be used to override values or provide a help

options :: forall s a. (KnownSymbol s, Typeable a, Show a) => OptionDescriptionUpdates -> Registry _ _ Source #

Create a parser for a list of values

optionMaybe :: forall s a. (KnownSymbol s, Typeable a, Show a) => OptionDescriptionUpdates -> Registry _ _ Source #

Create a parser for an optional value

flag :: forall s a. (KnownSymbol s, Typeable a, Show a) => a -> Maybe a -> OptionDescriptionUpdates -> Registry _ _ Source #

Create a flag: - with a short/long name - a metavar - an active value - an optional default value

The OptionDescriptionUpdates list can be used to override values or provide a help

named :: forall s a. (KnownSymbol s, Typeable a, Show a) => OptionDescriptionUpdates -> Registry _ _ Source #

Create a flag where the name of the flag can be decoded as a value: The OptionDescriptionUpdates list can be used to override values or provide a help

switch :: forall s. KnownSymbol s => OptionDescriptionUpdates -> Registry _ _ Source #

Create a switch: - with a short/long name - a metavar - an active value: True - an default value: False

The OptionDescriptionUpdates list can be used to override values or provide a help

argument :: forall s a. (KnownSymbol s, Typeable a, Show a) => OptionDescriptionUpdates -> Registry _ _ Source #

Create an argument: - with no short/long names - a metavar - no active/default values

The OptionDescriptionUpdates list can be used to override values or provide a help

When the argument is read, its value is removed from the list of lexed values

arguments :: forall s a. (KnownSymbol s, Typeable a, Show a) => OptionDescriptionUpdates -> Registry _ _ Source #

Create a parser for a list of arguments

positional :: forall s a. (KnownSymbol s, Typeable a, Show a) => Int -> OptionDescriptionUpdates -> Registry _ _ Source #

Create a positional argument, to parse the nth value (starting from 0): - with no short/long names - a metavar - no active/default values

The OptionDescriptionUpdates list can be used to override values or provide a help

When the argument is read, its value is left in the list of lexed values

setActiveValue :: forall s a. (KnownSymbol s, Typeable a) => a -> Typed (ActiveValue s a) Source #

Set an active value for a given field name and field type

setDefaultValue :: forall s a. (KnownSymbol s, Typeable a) => a -> Typed (DefaultValue s a) Source #

Set a default value for a given field name and field type

setDefaultValues :: forall s a. (KnownSymbol s, Typeable a) => Maybe a -> Maybe a -> Registry _ _ Source #

Allow to specify that a given field name and type has some default/active values

setNoDefaultValues :: forall s a. (KnownSymbol s, Typeable a) => Registry _ _ Source #

Allow to specify that a given field name and type has no default/active values

Template Haskell

commandNameParser :: Text -> Parser Command () Source #

This function is used by the TH module to parse a command name at the beginning of a list of arguments