diff options
Diffstat (limited to 'tools/Sandcastle/Source/CommandLine/ListOption.cs')
-rw-r--r-- | tools/Sandcastle/Source/CommandLine/ListOption.cs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tools/Sandcastle/Source/CommandLine/ListOption.cs b/tools/Sandcastle/Source/CommandLine/ListOption.cs new file mode 100644 index 0000000..bc04851 --- /dev/null +++ b/tools/Sandcastle/Source/CommandLine/ListOption.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// + +using System; +using System.IO; +using System.Collections.Generic; + +namespace Microsoft.Ddue.Tools.CommandLine { + + public class ListOption : Option { + + private string template = "xxxx"; + + private List < string > values = new List < string >(); + + public ListOption(string name) : base(name) { } + + public ListOption(string name, string description) : base(name, description) { } + + public ListOption(string name, string description, string template) : base(name, description) { + this.template = template; + } + + public override Object Value { + get { + return (values.ToArray()); + } + } + + internal override ParseResult ParseArgument(string argument) { + if (argument.Length == 0) return (ParseResult.MalformedArgument); + if (argument[0] != ':') return (ParseResult.MalformedArgument); + present = true; + string[] atoms = argument.Substring(1).Split(','); + foreach (string atom in atoms) values.Add(atom); + return (ParseResult.Success); + } + + internal override void WriteTemplate(TextWriter writer) { + writer.WriteLine("/{0}:{1}[,{1},{1},...]", Name, template); + } + + } + +} |