blob: 93ea9fdada985ab4556bc386edc64cf6e2f036ae (
plain)
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
|
// Copyright (c) Microsoft Corporation. All rights reserved.
//
using System;
using System.IO;
using System.Collections.Generic;
namespace Microsoft.Ddue.Tools.CommandLine {
public sealed class BooleanOption : Option {
public BooleanOption(string name) : base(name) { }
public BooleanOption(string name, string description) : base(name, description) { }
internal override ParseResult ParseArgument(string argument) {
if ((argument != "+") && (argument != "-")) return (ParseResult.MalformedArgument);
if (present) return (ParseResult.MultipleOccurance);
present = true;
if (argument == "+") {
value = true;
} else {
value = false;
}
return (ParseResult.Success);
}
internal override void WriteTemplate(TextWriter writer) {
writer.WriteLine("/{0}+|-", Name);
}
}
}
|