Table of Contents

Class CmdlineParseItem

Namespace
SearchAThing.Cmdline
Assembly
netcore-cmdline.dll

describe properties required for a command, a flag or a parameter on the syntax for the cmdline parser; enumerating returns the list of values if this is a flag with value or a parameter or a parameter array

public class CmdlineParseItem : IEnumerable<string>, IEnumerable
Inheritance
CmdlineParseItem
Implements
Inherited Members

Properties

ArgValues

original cmdline argument associated as value to this item (may a flag with value or parameter)

public IReadOnlyList<CmdlineArgument> ArgValues { get; }

Property Value

IReadOnlyList<CmdlineArgument>

Description

description for this parse item to use in the usage or is parser description if this is a command

public string Description { get; }

Property Value

string

GlobalFlagAction

stores actiont to execute if this global flag item matches

public Action<CmdlineParseItem> GlobalFlagAction { get; }

Property Value

Action<CmdlineParseItem>

GlobalFlagActionNested

if false global flag action will executed immeditaly; if true execution will deferred to nested parser

public bool GlobalFlagActionNested { get; }

Property Value

bool

HasLongName

states if this element has a long name ( used only for flags )

public bool HasLongName { get; }

Property Value

bool

HasShortName

true if this item has a short name ( maybe a command, parameter or a flag with short name )

public bool HasShortName { get; }

Property Value

bool

HasValueName

states if this flag requires a value

public bool HasValueName { get; }

Property Value

bool

IsCommand

true if this is a command

public bool IsCommand { get; }

Property Value

bool

IsFlag

true if this is a flag

public bool IsFlag { get; }

Property Value

bool

IsGlobal

states if this parse item is a global flag

public bool IsGlobal { get; }

Property Value

bool

IsParameter

true if this is a parameter

public bool IsParameter { get; }

Property Value

bool

IsParameterArray

true is this is an array of parameters

public bool IsParameterArray { get; }

Property Value

bool

IsParameterOrArray

true if this is a parameter or array of parameters

public bool IsParameterOrArray { get; }

Property Value

bool

LongFlag

states if this item have a long name ( used only for flags )

public string LongFlag { get; }

Property Value

string

LongName

long name ( used only for flags )

public string LongName { get; }

Property Value

string

Mandatory

true if this item is mandatory

public bool Mandatory { get; }

Property Value

bool

MatchArgument

original argument with that this parse item matches

public CmdlineArgument MatchArgument { get; }

Property Value

CmdlineArgument

MatchParser

used to distinguish sub parser for global flags

public CmdlineParser MatchParser { get; }

Property Value

CmdlineParser

Matches

states if this flag have a matching with required usage

public bool Matches { get; }

Property Value

bool

Parser

parser which this item belongs to

public CmdlineParser Parser { get; }

Property Value

CmdlineParser

ShortFlag

short flag final string ( without value if any )

public string ShortFlag { get; }

Property Value

string

ShortLongFlag

short/long flag final string ( without value if any )

public string ShortLongFlag { get; }

Property Value

string

ShortName

short name of this element

public string ShortName { get; }

Property Value

string

SortOrder

helper to sort items in groups with follow order Commands, Flags, Parameters, Parameters array

public int SortOrder { get; }

Property Value

int

Type

type of this cmdline parser

public CmdlineParseItemType Type { get; }

Property Value

CmdlineParseItemType

ValueName

symbolic name for the flag value to display in the usage

public string ValueName { get; }

Property Value

string

Values

values associated to this item (may a flag with value or parameter)

public IReadOnlyList<string> Values { get; }

Property Value

IReadOnlyList<string>

Methods

GetEnumerator()

public IEnumerator<string> GetEnumerator()

Returns

IEnumerator<string>

OnCompletion(Func<string, IEnumerable<string>>)

set a runtime completion function ( used for parameter item types )

public void OnCompletion(Func<string, IEnumerable<string>> func)

Parameters

func Func<string, IEnumerable<string>>

Operators

implicit operator bool(CmdlineParseItem)

helper to check if this parse item meet usage rules

public static implicit operator bool(CmdlineParseItem item)

Parameters

item CmdlineParseItem

Returns

bool

implicit operator string(CmdlineParseItem)

helper to retrieve this item value ( used for flag value or single parameter )

public static implicit operator string(CmdlineParseItem item)

Parameters

item CmdlineParseItem

Returns

string