BadScript 2
Loading...
Searching...
No Matches
CommandLine.Core.Verb Class Referencesealed

Public Member Functions

 Verb (string name, string helpText, bool hidden, bool isDefault, string[] aliases)
 

Static Public Member Functions

static Verb FromAttribute (VerbAttribute attribute)
 
static IEnumerable< Tuple< Verb, Type > > SelectFromTypes (IEnumerable< Type > types)
 

Properties

string Name [get, private set]
 
string HelpText [get, private set]
 
bool Hidden [get, private set]
 
bool IsDefault [get, private set]
 
string[] Aliases [get, private set]
 

Detailed Description

Definition at line 10 of file Verb.cs.

Constructor & Destructor Documentation

◆ Verb()

CommandLine.Core.Verb.Verb ( string  name,
string  helpText,
bool  hidden,
bool  isDefault,
string[]  aliases 
)

Definition at line 12 of file Verb.cs.

13 {
14 if (string.IsNullOrWhiteSpace(name))
15 {
16 throw new ArgumentNullException(nameof(name));
17 }
18
19 Name = name;
20
21 HelpText = helpText ?? throw new ArgumentNullException(nameof(helpText));
22 Hidden = hidden;
23 IsDefault = isDefault;
24 Aliases = aliases ?? new string[0];
25 }
string[] Aliases
Definition Verb.cs:35

Member Function Documentation

◆ FromAttribute()

static Verb CommandLine.Core.Verb.FromAttribute ( VerbAttribute  attribute)
static

Definition at line 37 of file Verb.cs.

38 {
39 return new Verb(attribute.Name,
40 attribute.HelpText,
41 attribute.Hidden,
42 attribute.IsDefault,
43 attribute.Aliases
44 );
45 }
Verb(string name, string helpText, bool hidden, bool isDefault, string[] aliases)
Definition Verb.cs:12

◆ SelectFromTypes()

static IEnumerable< Tuple< Verb, Type > > CommandLine.Core.Verb.SelectFromTypes ( IEnumerable< Type >  types)
static

Definition at line 47 of file Verb.cs.

48 {
49 return from type in types
50 let attrs = type.GetTypeInfo()
51 .GetCustomAttributes(typeof(VerbAttribute), true)
52 .ToArray()
53 where attrs.Length == 1
54 select Tuple.Create(FromAttribute((VerbAttribute)attrs.Single()),
55 type
56 );
57 }
static Verb FromAttribute(VerbAttribute attribute)
Definition Verb.cs:37

Property Documentation

◆ Aliases

string [] CommandLine.Core.Verb.Aliases
getprivate set

Definition at line 35 of file Verb.cs.

35{ get; private set; }

◆ HelpText

string CommandLine.Core.Verb.HelpText
getprivate set

Definition at line 29 of file Verb.cs.

29{ get; private set; }

◆ Hidden

bool CommandLine.Core.Verb.Hidden
getprivate set

Definition at line 31 of file Verb.cs.

31{ get; private set; }

◆ IsDefault

bool CommandLine.Core.Verb.IsDefault
getprivate set

Definition at line 33 of file Verb.cs.

33{ get; private set; }

◆ Name

string CommandLine.Core.Verb.Name
getprivate set

Definition at line 27 of file Verb.cs.

27{ get; private set; }

The documentation for this class was generated from the following file: