Home Reference Source Test Repository
public class | source

Option

Option definition that can be parse by Parser.

Test:

Constructor Summary

Public Constructor
public

constructor(descOrOptions: string | Option.Options)

Creates a new option based on a description or some options.

Member Summary

Public Members
public

The alias to use for the option.

public

A short string describing the option.

public get

Whether or not the option requires a value to be passed.

public

The option's type. One of OptionType.

Method Summary

Public Methods
public

parsedValue(value: string): *

Casts the given value to the appropriate type.

Public Constructors

public constructor(descOrOptions: string | Option.Options) source

Creates a new option based on a description or some options. If a string is passed Option#type is set to OptionType.Boolean by default.

Params:

NameTypeAttributeDescription
descOrOptions string | Option.Options

The description or options used to create the Option.

Test:

Public Members

public alias: string source

The alias to use for the option.

public description: string source

A short string describing the option.

public get requiresValue: boolean source

Whether or not the option requires a value to be passed.

Test:

public type: string source

The option's type. One of OptionType.

Public Methods

public parsedValue(value: string): * source

Casts the given value to the appropriate type. If an invalid value is passed null is returned.

Params:

NameTypeAttributeDescription
value string

The value to parse.

Return:

* (nullable: true)

The parsed value or null.

Test: