summaryrefslogtreecommitdiffstats
path: root/tools/Sandcastle/Source/CommandLine/BooleanOption.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tools/Sandcastle/Source/CommandLine/BooleanOption.cs')
-rw-r--r--tools/Sandcastle/Source/CommandLine/BooleanOption.cs34
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/Sandcastle/Source/CommandLine/BooleanOption.cs b/tools/Sandcastle/Source/CommandLine/BooleanOption.cs
new file mode 100644
index 0000000..93ea9fd
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/BooleanOption.cs
@@ -0,0 +1,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);
+ }
+
+ }
+
+}