BadScript 2
Loading...
Searching...
No Matches
NameExtensions.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
3
using
System;
4
5
namespace
CommandLine.Core
6
{
7
internal
static
class
NameExtensions
8
{
9
public
static
bool
MatchName
(
this
string
value,
string
shortName,
string
longName, StringComparer comparer)
10
{
11
return
value.Length == 1
12
? comparer.Equals(value, shortName)
13
: comparer.Equals(value, longName);
14
}
15
16
public
static
NameInfo
FromOptionSpecification
(
this
OptionSpecification
specification)
17
{
18
return
new
NameInfo
(specification.
ShortName
,
19
specification.
LongName
20
);
21
}
22
23
public
static
NameInfo
FromSpecification
(
this
Specification
specification)
24
{
25
switch
(specification.
Tag
)
26
{
27
case
SpecificationType
.Option:
28
return
FromOptionSpecification
((
OptionSpecification
)specification);
29
default
:
30
return
NameInfo
.
EmptyName
;
31
}
32
}
33
}
34
}
CommandLine.Core.NameExtensions
Definition
NameExtensions.cs:8
CommandLine.Core.NameExtensions.FromOptionSpecification
static NameInfo FromOptionSpecification(this OptionSpecification specification)
Definition
NameExtensions.cs:16
CommandLine.Core.NameExtensions.FromSpecification
static NameInfo FromSpecification(this Specification specification)
Definition
NameExtensions.cs:23
CommandLine.Core.NameExtensions.MatchName
static bool MatchName(this string value, string shortName, string longName, StringComparer comparer)
Definition
NameExtensions.cs:9
CommandLine.Core.OptionSpecification
Definition
OptionSpecification.cs:12
CommandLine.Core.OptionSpecification.ShortName
string ShortName
Definition
OptionSpecification.cs:50
CommandLine.Core.OptionSpecification.LongName
string LongName
Definition
OptionSpecification.cs:52
CommandLine.Core.Specification
Definition
Specification.cs:28
CommandLine.Core.Specification.Tag
SpecificationType Tag
Definition
Specification.cs:54
CommandLine.NameInfo
Models name information, used in CommandLine.Error instances.
Definition
NameInfo.cs:11
CommandLine.NameInfo.EmptyName
static readonly NameInfo EmptyName
Represents an empty name information. Used when CommandLine.Error are tied to values,...
Definition
NameInfo.cs:16
CommandLine.Core
Definition
ArgumentsExtensions.cs:10
CommandLine.Core.SpecificationType
SpecificationType
Definition
Specification.cs:15
deps
commandlineparser
src
CommandLine
Core
NameExtensions.cs
Generated by
1.9.8