forked from commandlineparser/commandline
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathValueAttribute.cs
More file actions
45 lines (40 loc) · 1.36 KB
/
ValueAttribute.cs
File metadata and controls
45 lines (40 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
using System;
namespace CommandLine
{
/// <summary>
/// Models an value specification, or better how to handle values not bound to options.
/// </summary>
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public sealed class ValueAttribute : BaseAttribute
{
private readonly int index;
private string metaName;
/// <summary>
/// Initializes a new instance of the <see cref="CommandLine.ValueAttribute"/> class.
/// </summary>
public ValueAttribute(int index) : base()
{
this.index = index;
this.metaName = string.Empty;
}
/// <summary>
/// Gets the position this option has on the command line.
/// </summary>
public int Index
{
get { return index; }
}
/// <summary>
/// Gets or sets name of this positional value specification.
/// </summary>
public string MetaName
{
get { return metaName; }
set
{
metaName = value ?? throw new ArgumentNullException("value");
}
}
}
}