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

Data.Registry.Options.OptionDescription

Description

Description for options A option has a long name (unless it's an argument), a short name, a metavar (its type), a help text

Synopsis

Documentation

data OptionDescription Source #

Optional values used to document a command line option

  • name is a "long" name, like launch-missiles
  • short is just a character, like l
  • metavar describes the type of value which is expected, like BOOL
  • help is a piece of text describing the usage of the option, like "destroy everything"

Instances

Instances details
Monoid OptionDescription Source # 
Instance details

Defined in Data.Registry.Options.OptionDescription

Semigroup OptionDescription Source #

The Semigroup instance is used to collect several descriptions and aggregate them together, for example name "force" <> short 'f'

The second option always takes precedence on the first one for example metavar "m1" <> metavar "m2" == metavar "m2"

Instance details

Defined in Data.Registry.Options.OptionDescription

Show OptionDescription Source # 
Instance details

Defined in Data.Registry.Options.OptionDescription

Eq OptionDescription Source # 
Instance details

Defined in Data.Registry.Options.OptionDescription

Lift OptionDescription Source # 
Instance details

Defined in Data.Registry.Options.TH

Methods

lift :: Quote m => OptionDescription -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => OptionDescription -> Code m OptionDescription #

type OptionDescriptionUpdate = OptionDescription -> OptionDescription Source #

Function updating an OptionDescription

type OptionDescriptionUpdates = [OptionDescriptionUpdate] Source #

List of description updates

makeOptionDescription :: OptionDescriptionUpdates -> OptionDescription Source #

Apply a list of option description updates, from left to right, to the empty description

name :: Text -> OptionDescriptionUpdate Source #

Create an OptionDescriptionUpdate with a long hyphenated name, for example name "collect-all"

alias :: Text -> OptionDescriptionUpdate Source #

Create an OptionDescriptionUpdate with an alias for a given name

short :: Char -> OptionDescriptionUpdate Source #

Create an OptionDescriptionUpdate with a short name, for example short 'q'

noShort :: OptionDescriptionUpdate Source #

Create an OptionDescriptionUpdate with specifying that there must be no short name

metavar :: Text -> OptionDescriptionUpdate Source #

Create an OptionDescriptionUpdate with a metavar to indicate the type of an option, for example metavar FILE

help :: Text -> OptionDescriptionUpdate Source #

Create an OptionDescriptionUpdate with some help text, for example help "force the copy"

displayCliOptionName :: OptionDescription -> Text Source #

Display a OptionDescription name as a hyphenated name return empty if no name has been defined yet

getNames :: OptionDescription -> [Text] Source #

Return the possible names for an OptionDescription if they are defined