BadScript 2
Loading...
Searching...
No Matches
CommandLine.BaseAttribute Class Referenceabstract

Models a base attribute to define command line syntax. More...

Inheritance diagram for CommandLine.BaseAttribute:
CommandLine.OptionAttribute CommandLine.Tests.Unit.BaseAttributeTests.TestBaseAttribute CommandLine.ValueAttribute

Package Functions

 BaseAttribute ()
 Initializes a new instance of the CommandLine.BaseAttribute class.
 

Properties

bool Required [get, set]
 Gets or sets a value indicating whether a command line option is required.
 
int Min [get, set]
 When applied to System.Collections.Generic.IEnumerable<T> properties defines the lower range of items.
 
int Max [get, set]
 When applied to System.Collections.Generic.IEnumerable<T> properties defines the upper range of items.
 
object Default [get, set]
 Gets or sets mapped property default value.
 
string HelpText [get, set]
 Gets or sets a short description of this command line option. Usually a sentence summary.
 
string MetaValue [get, set]
 Gets or sets mapped property meta value. Usually an uppercase hint of required value type.
 
bool Hidden [get, set]
 Gets or sets a value indicating whether a command line option is visible in the help text.
 
Type ResourceType [get, set]
 Gets or sets the System.Type that contains the resources for HelpText.
 

Private Attributes

readonly LocalizableAttributeProperty helpText
 
int max
 
string metaValue
 
int min
 
Type resourceType
 

Detailed Description

Models a base attribute to define command line syntax.

Definition at line 12 of file BaseAttribute.cs.

Constructor & Destructor Documentation

◆ BaseAttribute()

CommandLine.BaseAttribute.BaseAttribute ( )
package

Initializes a new instance of the CommandLine.BaseAttribute class.

Definition at line 23 of file BaseAttribute.cs.

24 {
25 min = -1;
26 max = -1;
28 metaValue = string.Empty;
29 resourceType = null;
30 }
readonly LocalizableAttributeProperty helpText
string HelpText
Gets or sets a short description of this command line option. Usually a sentence summary.

Member Data Documentation

◆ helpText

readonly LocalizableAttributeProperty CommandLine.BaseAttribute.helpText
private

Definition at line 14 of file BaseAttribute.cs.

◆ max

int CommandLine.BaseAttribute.max
private

Definition at line 15 of file BaseAttribute.cs.

◆ metaValue

string CommandLine.BaseAttribute.metaValue
private

Definition at line 16 of file BaseAttribute.cs.

◆ min

int CommandLine.BaseAttribute.min
private

Definition at line 17 of file BaseAttribute.cs.

◆ resourceType

Type CommandLine.BaseAttribute.resourceType
private

Definition at line 18 of file BaseAttribute.cs.

Property Documentation

◆ Default

object CommandLine.BaseAttribute.Default
getset

Gets or sets mapped property default value.

Definition at line 78 of file BaseAttribute.cs.

78{ get; set; }

◆ HelpText

string CommandLine.BaseAttribute.HelpText
getset

Gets or sets a short description of this command line option. Usually a sentence summary.

Definition at line 83 of file BaseAttribute.cs.

84 {
85 get => helpText.Value ?? string.Empty;
86 set => helpText.Value = value ?? throw new ArgumentNullException("value");
87 }

◆ Hidden

bool CommandLine.BaseAttribute.Hidden
getset

Gets or sets a value indicating whether a command line option is visible in the help text.

Definition at line 109 of file BaseAttribute.cs.

109{ get; set; }

◆ Max

int CommandLine.BaseAttribute.Max
getset

When applied to System.Collections.Generic.IEnumerable<T> properties defines the upper range of items.

If not set, no upper range is enforced.

Definition at line 61 of file BaseAttribute.cs.

62 {
63 get => max;
64 set
65 {
66 if (value < 0)
67 {
68 throw new ArgumentNullException("value");
69 }
70
71 max = value;
72 }
73 }

◆ MetaValue

string CommandLine.BaseAttribute.MetaValue
getset

Gets or sets mapped property meta value. Usually an uppercase hint of required value type.

Definition at line 92 of file BaseAttribute.cs.

93 {
94 get => metaValue;
95 set
96 {
97 if (value == null)
98 {
99 throw new ArgumentNullException("value");
100 }
101
102 metaValue = value;
103 }
104 }

◆ Min

int CommandLine.BaseAttribute.Min
getset

When applied to System.Collections.Generic.IEnumerable<T> properties defines the lower range of items.

If not set, no lower range is enforced.

Definition at line 42 of file BaseAttribute.cs.

43 {
44 get => min;
45 set
46 {
47 if (value < 0)
48 {
49 throw new ArgumentNullException("value");
50 }
51
52 min = value;
53 }
54 }

◆ Required

bool CommandLine.BaseAttribute.Required
getset

Gets or sets a value indicating whether a command line option is required.

Definition at line 35 of file BaseAttribute.cs.

35{ get; set; }

◆ ResourceType

Type CommandLine.BaseAttribute.ResourceType
getset

Gets or sets the System.Type that contains the resources for HelpText.

Definition at line 114 of file BaseAttribute.cs.

115 {
116 get => resourceType;
117 set => resourceType =
118 helpText.ResourceType = value;
119 }

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