Argu


ArgumentParser Type

Namespace: Argu

Assembly: Argu.dll


Base Type: obj

The Argu type generates an argument parser given a type argument that is an F# discriminated union. It can then be used to parse command line arguments or XML configuration.

Instance members

Instance member Description
this.Accept(visitor)
Full Usage:
this.Accept(visitor) Parameter Types:
  • visitor : IArgumentParserVisitor<'R>

Return Type: 'R
Signature: (visitor: IArgumentParserVisitor<'R>) -> 'R
Modifiers: abstract
Type parameters: 'R

Enables access to the typed API of an ArgumentParser when template type is unknown.

Parameters

visitor

Visitor used to access the parser.


Parameter Types:
  • visitor : IArgumentParserVisitor<'R>
Return Type: 'R
this.ErrorHandler
Full Usage:
this.ErrorHandler
Return Type: IExiter
Signature: IExiter

Gets the default error handler used by the instance


Return Type: IExiter
this.GetArgumentCases()
Full Usage:
this.GetArgumentCases()
Return Type: ArgumentCaseInfo list
Signature: unit -> ArgumentCaseInfo list

Gets metadata for all union cases used by parser


Return Type: ArgumentCaseInfo list
this.GetSubCommandParsers()
Full Usage:
this.GetSubCommandParsers()
Return Type: ArgumentParser list
Signature: unit -> ArgumentParser list

Gets all subcommand parsers for given parser


Return Type: ArgumentParser list
this.HelpDescription
Full Usage:
this.HelpDescription
Return Type: string
Signature: string

Gets the help description specified for the CLI parser


Return Type: string
this.HelpFlags
Full Usage:
this.HelpFlags
Return Type: string list
Signature: string list

Gets the help flags specified for the CLI parser


Return Type: string list
this.HelpTextMessage
Full Usage:
this.HelpTextMessage
Return Type: string option
Signature: string option

Gets the message that will be displayed at the top of the help text


Return Type: string option
this.IsSubCommandParser
Full Usage:
this.IsSubCommandParser
Return Type: bool
Signature: bool

Returns true if parser corresponds to a subcommand


Return Type: bool
this.ParentInfo
Full Usage:
this.ParentInfo
Return Type: ArgumentCaseInfo option
Signature: ArgumentCaseInfo option

If subcommand parser, gets parent argument metadata


Return Type: ArgumentCaseInfo option
this.PrintCommandLineSyntax(?programName, ?usageStringCharacterWidth)
Full Usage:
this.PrintCommandLineSyntax(?programName, ?usageStringCharacterWidth) Parameter Types:
  • ?programName : string
  • ?usageStringCharacterWidth : int

Return Type: string
Signature: (programName: string * usageStringCharacterWidth: int) -> string

Prints command line syntax. Useful for generating documentation.

Parameters

programName

Program name identifier placed at start of syntax string

usageStringCharacterWidth

Text width used when formatting the usage string.


Parameter Types:
  • ?programName : string
  • ?usageStringCharacterWidth : int
Return Type: string
this.PrintUsage(?message, ?programName, ?hideSyntax, ?usageStringCharacterWidth)
Full Usage:
this.PrintUsage(?message, ?programName, ?hideSyntax, ?usageStringCharacterWidth) Parameter Types:
  • ?message : string
  • ?programName : string
  • ?hideSyntax : bool
  • ?usageStringCharacterWidth : int

Return Type: string
Signature: (message: string * programName: string * hideSyntax: bool * usageStringCharacterWidth: int) -> string

Formats a usage string for the argument parser.

Parameters

message

The message to be displayed on top of the usage string.

programName

Override the default program name settings.

hideSyntax

Do not display 'USAGE: [syntax]' at top of usage string. Defaults to false.

usageStringCharacterWidth

Text width used when formatting the usage string.


Parameter Types:
  • ?message : string
  • ?programName : string
  • ?hideSyntax : bool
  • ?usageStringCharacterWidth : int
Return Type: string

Static members

Static member Description
ArgumentParser.Create(?programName, ?helpTextMessage, ?usageStringCharacterWidth, ?errorHandler, ?checkStructure)
Full Usage:
ArgumentParser.Create(?programName, ?helpTextMessage, ?usageStringCharacterWidth, ?errorHandler, ?checkStructure) Parameter Types:
  • ?programName : string
  • ?helpTextMessage : string
  • ?usageStringCharacterWidth : int
  • ?errorHandler : IExiter
  • ?checkStructure : bool

Return Type: ArgumentParser<'Template>
Signature: (programName: string * helpTextMessage: string * usageStringCharacterWidth: int * errorHandler: IExiter * checkStructure: bool) -> ArgumentParser<'Template>

Create a new argument parsing scheme using given 'Template type which must be an F# Discriminated Union.

Parameters

programName

Program identifier, e.g. 'cat'. Defaults to the current executable name.

helpTextMessage

Message that will be displayed at the top of the help text.

usageStringCharacterWidth

Text width used when formatting the usage string. Defaults to 80 chars.

errorHandler

The implementation of IExiter used for error handling. Exception is default.

checkStructure

Indicate if the structure of the arguments discriminated union should be checked for errors.


Parameter Types:
  • ?programName : string
  • ?helpTextMessage : string
  • ?usageStringCharacterWidth : int
  • ?errorHandler : IExiter
  • ?checkStructure : bool
Return Type: ArgumentParser<'Template>
Fork me on GitHub