BadScript 2
Loading...
Searching...
No Matches
VerbAttribute.cs
Go to the documentation of this file.
1// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
2
3using System;
4
6
7namespace CommandLine
8{
12 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
13 //public sealed class VerbAttribute : Attribute
14 public class VerbAttribute : Attribute
15 {
17 private Type resourceType;
18
29 public VerbAttribute(string name, bool isDefault = false, string[] aliases = null)
30 {
31 if (string.IsNullOrWhiteSpace(name))
32 {
33 throw new ArgumentException("name");
34 }
35
36 Name = name;
37 IsDefault = isDefault;
39 resourceType = null;
40 Aliases = aliases ?? new string[0];
41 }
42
46 public string Name { get; private set; }
47
51 public bool Hidden { get; set; }
52
56 public string HelpText
57 {
58 get => helpText.Value ?? string.Empty;
59 set => helpText.Value = value ?? throw new ArgumentNullException("value");
60 }
61
65 public Type ResourceType
66 {
67 get => resourceType;
68 set => resourceType = helpText.ResourceType = value;
69 }
70
74 public bool IsDefault { get; private set; }
75
79 public string[] Aliases { get; private set; }
80 }
81}
Models a verb command specification.
string HelpText
Gets or sets a short description of this command line option. Usually a sentence summary.
bool Hidden
Gets or sets a value indicating whether a command line verb is visible in the help text.
Type ResourceType
Gets or sets the System.Type that contains the resources for HelpText.
string Name
Gets the verb name.
string[] Aliases
Gets or sets the aliases.
readonly LocalizableAttributeProperty helpText
bool IsDefault
Gets whether this verb is the default verb.
VerbAttribute(string name, bool isDefault=false, string[] aliases=null)
Initializes a new instance of the CommandLine.VerbAttribute class.