diff options
14 files changed, 1007 insertions, 98 deletions
diff --git a/data/mono-options.pc.in b/data/mono-options.pc.in index 028ff763f33..8c569820d4e 100644 --- a/data/mono-options.pc.in +++ b/data/mono-options.pc.in @@ -4,4 +4,4 @@ Sources=${assemblies_dir}/Options.cs Name: Mono.Options Description: Command Line Parsing Library -Version: 0.2.1 +Version: 0.2.2 diff --git a/mcs/class/Mono.Options/Assembly/AssemblyInfo.cs b/mcs/class/Mono.Options/Assembly/AssemblyInfo.cs index 183af76b037..281d53b44f9 100644 --- a/mcs/class/Mono.Options/Assembly/AssemblyInfo.cs +++ b/mcs/class/Mono.Options/Assembly/AssemblyInfo.cs @@ -41,7 +41,7 @@ using System.Security.Permissions; // // DO NOT MODIFY STRINGS BELOW WITHOUT UPDATING mono/data/mono-options.pc.in // - "0.2.1.0" + "0.2.2.0" // // DO NOT MODIFY STRINGS ABOVE WITHOUT UPDATING mono/data/mono-options.pc.in // diff --git a/mcs/class/Mono.Options/Documentation/en/Mono.Options/ArgumentSource.xml b/mcs/class/Mono.Options/Documentation/en/Mono.Options/ArgumentSource.xml new file mode 100644 index 00000000000..83d92060659 --- /dev/null +++ b/mcs/class/Mono.Options/Documentation/en/Mono.Options/ArgumentSource.xml @@ -0,0 +1,238 @@ +<Type Name="ArgumentSource" FullName="Mono.Options.ArgumentSource"> + <TypeSignature Language="C#" Value="public abstract class ArgumentSource" /> + <TypeSignature Language="ILAsm" Value=".class public auto ansi abstract beforefieldinit ArgumentSource extends System.Object" /> + <AssemblyInfo> + <AssemblyName>Mono.Options</AssemblyName> + <AssemblyVersion>0.2.2.0</AssemblyVersion> + </AssemblyInfo> + <Base> + <BaseTypeName>System.Object</BaseTypeName> + </Base> + <Interfaces /> + <Docs> + <summary> + Support for inserting additional arguments during + <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" /> + processing. + </summary> + <remarks> + <para> + The <see cref="T:Mono.Options.ArgumentSource" /> type is an + abstraction to allow "insertion" of additional values for option + processing while processing arguments. + </para> + <para> + The principal use case is for <i>response files</i>, as used by + <c>CSC.EXE</c>, <c>CL.EXE</c>, and numerous other + compilers. A response file contains additional options for the tool, + and the contents of the response file should be "inserted" as if + entered on the command line. Response files are useful for bypassing + command-line length limitations, among other things. + </para> + <para> + Applications must opt-in to response file support by calling + <see cref="M:Mono.Options.OptionSet.Add(Mono.Options.ArgumentSource)" /> + before calling + <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />. + </para> + <block subset="none" type="overrides"> + Inheriting classes must override the following abstract methods: + <list type="bullet"><item><term><see cref="M:Mono.Options.ArgumentSource.GetNames" /></term></item><item><term><see cref="P:Mono.Options.ArgumentSource.Description" /></term></item><item><term><see cref="M:Mono.Options.ArgumentSource.GetArguments(System.Int32, System.Collections.Generic.IEnumerable{System.String}@)" /></term></item></list></block> + </remarks> + <altmember cref="T:Mono.Options.ResponseFileSource" /> + </Docs> + <Members> + <Member MemberName=".ctor"> + <MemberSignature Language="C#" Value="protected ArgumentSource ();" /> + <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" /> + <MemberType>Constructor</MemberType> + <AssemblyInfo> + <AssemblyVersion>0.2.2.0</AssemblyVersion> + </AssemblyInfo> + <Parameters /> + <Docs> + <summary> + Construct and initialize a + <see cref="T:Mono.Options.ArgumentSource" /> instance. + </summary> + <remarks> + </remarks> + </Docs> + </Member> + <Member MemberName="Description"> + <MemberSignature Language="C#" Value="public abstract string Description { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance string Description" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>0.2.2.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.String</ReturnType> + </ReturnValue> + <Docs> + <summary> + The description to provide for the argument source within + <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions(System.IO.TextWriter)" />. + </summary> + <value> + A <see cref="T:System.String" /> containing + the description to provide for the argument source within + <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions(System.IO.TextWriter)" />. + </value> + <remarks> + </remarks> + </Docs> + </Member> + <Member MemberName="GetArguments"> + <MemberSignature Language="C#" Value="public static System.Collections.Generic.IEnumerable<string> GetArguments (System.IO.TextReader reader);" /> + <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Collections.Generic.IEnumerable`1<string> GetArguments(class System.IO.TextReader reader) cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>0.2.2.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Collections.Generic.IEnumerable<System.String></ReturnType> + </ReturnValue> + <Parameters> + <Parameter Name="reader" Type="System.IO.TextReader" /> + </Parameters> + <Docs> + <param name="reader"> + A <see cref="T:System.IO.TextReader" /> to extract arguments from. + </param> + <summary> + Extract arguments from a <see cref="T:System.IO.TextReader" />. + </summary> + <returns> + A <see cref="T:System.Collections.Generic.IEnumerable{System.String}" /> + which will provide arguments extracted from <paramref name="reader" />. + </returns> + <remarks> + <para> + Arguments are extracted from <paramref name="reader" /> by + splitting on newlines and spaces but maintaining the contents of + single-quoted and double-quoted strings. Thus, <c>A B</c> will be + split as the separate strings <c>"A", "B"</c>, while + <c>"A B"</c> will be returned as-is. + </para> + <block subset="none" type="note"> + <paramref name="reader" /> is not + <see cref="M:System.IO>TextReader.Close" />d. + </block> + </remarks> + </Docs> + </Member> + <Member MemberName="GetArguments"> + <MemberSignature Language="C#" Value="public abstract bool GetArguments (string value, out System.Collections.Generic.IEnumerable<string> replacement);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool GetArguments(string value, class System.Collections.Generic.IEnumerable`1<string> replacement) cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>0.2.2.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Boolean</ReturnType> + </ReturnValue> + <Parameters> + <Parameter Name="value" Type="System.String" /> + <Parameter Name="replacement" Type="System.Collections.Generic.IEnumerable<System.String>&" RefType="out" /> + </Parameters> + <Docs> + <param name="value"> + A <see cref="T:System.String" /> containing the argument to replace + with additional arguments. + </param> + <param name="replacement"> + A <see cref="T:System.Collections.Generic.IEnumerable{System.String}" /> + which will refer to teh replacement arguments if this method returns + <see langword="true" />; otherwise, this value should be ignored by + callers. + </param> + <summary> + Replace the argument <paramref name="value" /> with a set of + replacement arguments. + </summary> + <returns> + <see langword="true" /> if this + <see cref="T:Mono.Options.ArgumentSource" /> will replace + <paramref name="value" /> with a set of replacement strings and + <paramref name="replacement" /> contains the replacement strings; + otherwise, <see langword="false" />. + </returns> + <remarks> + <para> + Before + <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" /> + attempts to parse an argument as an option (or option value), all + registered <see cref="T:Mono.Options.OptionSet.ArgumentSources" /> + are consulted in registration order to see if + <see cref="T:Mono.Options.ArgumentSource" /> "supports" the + argument via + <see cref="M:Mono.Options.ArgumentSource.GetArguments(System.Int32, System.Collections.Generic.IEnumerable{System.String}@)" />. + The first <c>ArgumentSource</c> to return <see langword="true" /> + from <c>GetArguments()</c> may provide the replacement tokens, and + no later <c>ArgumentSource</c>es are consulted. + </para> + </remarks> + <altmember cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" /> + </Docs> + </Member> + <Member MemberName="GetArgumentsFromFile"> + <MemberSignature Language="C#" Value="public static System.Collections.Generic.IEnumerable<string> GetArgumentsFromFile (string file);" /> + <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Collections.Generic.IEnumerable`1<string> GetArgumentsFromFile(string file) cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>0.2.2.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Collections.Generic.IEnumerable<System.String></ReturnType> + </ReturnValue> + <Parameters> + <Parameter Name="file" Type="System.String" /> + </Parameters> + <Docs> + <param name="file"> + A <see cref="T:System.String" /> containing the file to extract + arguments from. + </param> + <summary> + Extract arguments from the specified filename. + </summary> + <returns> + A <see cref="T:System.Collections.Generic.IEnumerable{System.String}" /> + which will provide arguments extracted from <paramref name="file" />. + </returns> + <remarks> + </remarks> + <exception cref="T:System.IO.IOException"> + <paramref name="file" /> could not be read. + </exception> + <altmember cref="M:Mono.Options.ArgumentSource.GetArguments(System.IO.TextReader)" /> + </Docs> + </Member> + <Member MemberName="GetNames"> + <MemberSignature Language="C#" Value="public abstract string[] GetNames ();" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance string[] GetNames() cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>0.2.2.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.String[]</ReturnType> + </ReturnValue> + <Parameters /> + <Docs> + <summary> + The names to provide for the argument source within + <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions(System.IO.TextWriter)" />. + </summary> + <returns> + A <see cref="T:System.String" /> array containing + the names to provide for the argument source within + <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions(System.IO.TextWriter)" />. + </returns> + <remarks> + </remarks> + </Docs> + </Member> + </Members> +</Type> diff --git a/mcs/class/Mono.Options/Documentation/en/Mono.Options/Option.xml b/mcs/class/Mono.Options/Documentation/en/Mono.Options/Option.xml index 859bb4be296..f3e7e547a97 100644 --- a/mcs/class/Mono.Options/Documentation/en/Mono.Options/Option.xml +++ b/mcs/class/Mono.Options/Documentation/en/Mono.Options/Option.xml @@ -1,9 +1,11 @@ <Type Name="Option" FullName="Mono.Options.Option"> <TypeSignature Language="C#" Value="public abstract class Option" /> + <TypeSignature Language="ILAsm" Value=".class public auto ansi abstract beforefieldinit Option extends System.Object" /> <AssemblyInfo> <AssemblyName>Mono.Options</AssemblyName> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ThreadingSafetyStatement> All members of this type are safe for multithreaded operations. @@ -86,10 +88,12 @@ <Members> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="protected Option (string prototype, string description);" /> + <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor(string prototype, string description) cil managed" /> <MemberType>Constructor</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <Parameters> <Parameter Name="prototype" Type="System.String" /> @@ -154,10 +158,12 @@ </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="protected Option (string prototype, string description, int maxValueCount);" /> + <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor(string prototype, string description, int32 maxValueCount) cil managed" /> <MemberType>Constructor</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <Parameters> <Parameter Name="prototype" Type="System.String" /> @@ -348,10 +354,12 @@ </Member> <Member MemberName="Description"> <MemberSignature Language="C#" Value="public string Description { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance string Description" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.String</ReturnType> @@ -379,10 +387,12 @@ </Member> <Member MemberName="GetNames"> <MemberSignature Language="C#" Value="public string[] GetNames ();" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig instance string[] GetNames() cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.String[]</ReturnType> @@ -407,10 +417,12 @@ </Member> <Member MemberName="GetValueSeparators"> <MemberSignature Language="C#" Value="public string[] GetValueSeparators ();" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig instance string[] GetValueSeparators() cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.String[]</ReturnType> @@ -456,10 +468,12 @@ </Member> <Member MemberName="Invoke"> <MemberSignature Language="C#" Value="public void Invoke (Mono.Options.OptionContext c);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Invoke(class Mono.Options.OptionContext c) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Void</ReturnType> @@ -507,10 +521,12 @@ </Member> <Member MemberName="MaxValueCount"> <MemberSignature Language="C#" Value="public int MaxValueCount { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance int32 MaxValueCount" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Int32</ReturnType> @@ -544,10 +560,12 @@ </Member> <Member MemberName="OnParseComplete"> <MemberSignature Language="C#" Value="protected abstract void OnParseComplete (Mono.Options.OptionContext c);" /> + <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void OnParseComplete(class Mono.Options.OptionContext c) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Void</ReturnType> @@ -587,7 +605,7 @@ <code lang="C#" src="examples/subclass.cs">// Case-Insensitive and Concatenating OptionSet using System; using System.Collections.Generic; -using Mono.Options; +using NDesk.Options; class DemoOptionSet : OptionSet { protected override void InsertItem (int index, Option item) @@ -730,10 +748,12 @@ class Demo { </Member> <Member MemberName="OptionValueType"> <MemberSignature Language="C#" Value="public Mono.Options.OptionValueType OptionValueType { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance valuetype Mono.Options.OptionValueType OptionValueType" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>Mono.Options.OptionValueType</ReturnType> @@ -758,14 +778,19 @@ class Demo { </Member> <Member MemberName="Parse<T>"> <MemberSignature Language="C#" Value="protected static T Parse<T> (string value, Mono.Options.OptionContext c);" /> + <MemberSignature Language="ILAsm" Value=".method familystatic hidebysig !!T Parse<T>(string value, class Mono.Options.OptionContext c) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>T</ReturnType> </ReturnValue> + <TypeParameters> + <TypeParameter Name="T" /> + </TypeParameters> <Parameters> <Parameter Name="value" Type="System.String" /> <Parameter Name="c" Type="Mono.Options.OptionContext" /> @@ -811,16 +836,15 @@ class Demo { <paramref name="value" />. </exception> </Docs> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> </Member> <Member MemberName="Prototype"> <MemberSignature Language="C#" Value="public string Prototype { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance string Prototype" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.String</ReturnType> @@ -850,10 +874,12 @@ class Demo { </Member> <Member MemberName="ToString"> <MemberSignature Language="C#" Value="public override string ToString ();" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance string ToString() cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.String</ReturnType> diff --git a/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionAction`2.xml b/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionAction`2.xml index ab8ffdb8f1c..0fbd6ce3d7b 100644 --- a/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionAction`2.xml +++ b/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionAction`2.xml @@ -1,9 +1,11 @@ <Type Name="OptionAction<TKey,TValue>" FullName="Mono.Options.OptionAction<TKey,TValue>"> <TypeSignature Language="C#" Value="public delegate void OptionAction<TKey,TValue>(TKey key, TValue value);" /> + <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed OptionAction`2<TKey, TValue> extends System.MulticastDelegate" /> <AssemblyInfo> <AssemblyName>Mono.Options</AssemblyName> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <TypeParameters> <TypeParameter Name="TKey" /> diff --git a/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionContext.xml b/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionContext.xml index d75832d2fe4..87abd3c8902 100644 --- a/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionContext.xml +++ b/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionContext.xml @@ -1,9 +1,11 @@ <Type Name="OptionContext" FullName="Mono.Options.OptionContext"> <TypeSignature Language="C#" Value="public class OptionContext" /> + <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit OptionContext extends System.Object" /> <AssemblyInfo> <AssemblyName>Mono.Options</AssemblyName> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <Base> <BaseTypeName>System.Object</BaseTypeName> @@ -22,10 +24,12 @@ <Members> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public OptionContext (Mono.Options.OptionSet set);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class Mono.Options.OptionSet set) cil managed" /> <MemberType>Constructor</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <Parameters> <Parameter Name="set" Type="Mono.Options.OptionSet" /> @@ -46,10 +50,12 @@ </Member> <Member MemberName="Option"> <MemberSignature Language="C#" Value="public Mono.Options.Option Option { set; get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance class Mono.Options.Option Option" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>Mono.Options.Option</ReturnType> @@ -63,10 +69,12 @@ </Member> <Member MemberName="OptionIndex"> <MemberSignature Language="C#" Value="public int OptionIndex { set; get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance int32 OptionIndex" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Int32</ReturnType> @@ -88,10 +96,12 @@ </Member> <Member MemberName="OptionName"> <MemberSignature Language="C#" Value="public string OptionName { set; get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance string OptionName" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.String</ReturnType> @@ -109,10 +119,12 @@ </Member> <Member MemberName="OptionSet"> <MemberSignature Language="C#" Value="public Mono.Options.OptionSet OptionSet { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance class Mono.Options.OptionSet OptionSet" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>Mono.Options.OptionSet</ReturnType> @@ -137,10 +149,12 @@ </Member> <Member MemberName="OptionValues"> <MemberSignature Language="C#" Value="public Mono.Options.OptionValueCollection OptionValues { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance class Mono.Options.OptionValueCollection OptionValues" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>Mono.Options.OptionValueCollection</ReturnType> diff --git a/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionException.xml b/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionException.xml index 3b65e4751b1..5ebfb683fd6 100644 --- a/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionException.xml +++ b/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionException.xml @@ -1,9 +1,11 @@ <Type Name="OptionException" FullName="Mono.Options.OptionException"> <TypeSignature Language="C#" Value="public class OptionException : Exception" /> + <TypeSignature Language="ILAsm" Value=".class public auto ansi serializable beforefieldinit OptionException extends System.Exception" /> <AssemblyInfo> <AssemblyName>Mono.Options</AssemblyName> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <Base> <BaseTypeName>System.Exception</BaseTypeName> @@ -44,9 +46,11 @@ <Members> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public OptionException ();" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> <MemberType>Constructor</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <Parameters /> <Docs> @@ -56,10 +60,12 @@ </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="protected OptionException (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" /> + <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor(class System.Runtime.Serialization.SerializationInfo info, valuetype System.Runtime.Serialization.StreamingContext context) cil managed" /> <MemberType>Constructor</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <Parameters> <Parameter Name="info" Type="System.Runtime.Serialization.SerializationInfo" /> @@ -90,10 +96,12 @@ </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public OptionException (string message, string optionName);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message, string optionName) cil managed" /> <MemberType>Constructor</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <Parameters> <Parameter Name="message" Type="System.String" /> @@ -122,10 +130,12 @@ </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public OptionException (string message, string optionName, Exception innerException);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string message, string optionName, class System.Exception innerException) cil managed" /> <MemberType>Constructor</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <Parameters> <Parameter Name="message" Type="System.String" /> @@ -163,10 +173,12 @@ </Member> <Member MemberName="GetObjectData"> <MemberSignature Language="C#" Value="public override void GetObjectData (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance void GetObjectData(class System.Runtime.Serialization.SerializationInfo info, valuetype System.Runtime.Serialization.StreamingContext context) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Void</ReturnType> @@ -201,10 +213,12 @@ </Member> <Member MemberName="OptionName"> <MemberSignature Language="C#" Value="public string OptionName { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance string OptionName" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.String</ReturnType> diff --git a/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionSet.xml b/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionSet.xml index 0be30b58c7c..6f0707a55da 100644 --- a/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionSet.xml +++ b/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionSet.xml @@ -1,9 +1,11 @@ <Type Name="OptionSet" FullName="Mono.Options.OptionSet"> <TypeSignature Language="C#" Value="public class OptionSet : System.Collections.ObjectModel.KeyedCollection<string,Mono.Options.Option>" /> + <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit OptionSet extends System.Collections.ObjectModel.KeyedCollection`2<string, class Mono.Options.Option>" /> <AssemblyInfo> <AssemblyName>Mono.Options</AssemblyName> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ThreadingSafetyStatement> All public static members of this type are safe for multithreaded @@ -18,8 +20,8 @@ <Base> <BaseTypeName>System.Collections.ObjectModel.KeyedCollection<System.String,Mono.Options.Option></BaseTypeName> <BaseTypeArguments> - <BaseTypeArgument TypeParamName="TKey">System.String</BaseTypeArgument> - <BaseTypeArgument TypeParamName="TItem">Mono.Options.Option</BaseTypeArgument> + <BaseTypeArgument TypeParamName="!0">System.String</BaseTypeArgument> + <BaseTypeArgument TypeParamName="!1">Mono.Options.Option</BaseTypeArgument> </BaseTypeArguments> </Base> <Interfaces /> @@ -49,6 +51,10 @@ <see cref="T:Mono.Options.Option" />. </para> <para> + Response files, as used by <c>mcs</c> and other compiler tools, may be + supported by using <see cref="T:Mono.Options.ResponseFileSource" />. + </para> + <para> Three conditions must be met for a sequence of arguments to be considered as a match for an <see cref="T:Mono.Options.Option" />: </para> @@ -290,7 +296,7 @@ </para> <code lang="C#" src="examples/greet.cs">using System; using System.Collections.Generic; -using Mono.Options; +using NDesk.Options; class Test { static int verbosity; @@ -437,7 +443,7 @@ Try `greet --help' for more information. <code lang="C#" src="examples/bundling.cs">using System; using System.Linq; using System.Collections.Generic; -using Mono.Options; +using NDesk.Options; class Test { public static void Main (string[] args) @@ -630,7 +636,7 @@ Options: <code lang="C#" src="examples/subclass.cs">// Case-Insensitive and Concatenating OptionSet using System; using System.Collections.Generic; -using Mono.Options; +using NDesk.Options; class DemoOptionSet : OptionSet { protected override void InsertItem (int index, Option item) @@ -813,14 +819,17 @@ Key: a\b\c=d\e\f </item> </list> </example> + <altmember cref="T:Mono.Options.ResponseFileSource" /> </Docs> <Members> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public OptionSet ();" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> <MemberType>Constructor</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <Parameters /> <Docs> @@ -841,10 +850,12 @@ Key: a\b\c=d\e\f </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public OptionSet (Converter<string,string> localizer);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Converter`2<string, string> localizer) cil managed" /> <MemberType>Constructor</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <Parameters> <Parameter Name="localizer" Type="System.Converter<System.String,System.String>" /> @@ -890,14 +901,14 @@ Key: a\b\c=d\e\f See the following example, which demonstrates how different localizers alter the program output. </para> - <code lang="C#" src="examples/localization.cs">// Localization with Mono.Options.OptionSet. + <code lang="C#" src="examples/localization.cs">// Localization with NDesk.Options.OptionSet. // // Compile as: -// gmcs -r:Mono.Posix.dll -r:Mono.Options.dll code-localization.cs +// gmcs -r:Mono.Posix.dll -r:NDesk.Options.dll code-localization.cs using System; using System.IO; using Mono.Unix; -using Mono.Options; +using NDesk.Options; class LocalizationDemo { public static void Main (string[] args) @@ -948,7 +959,7 @@ class LocalizationDemo { if (help) p.WriteOptionDescriptions (Console.Out); if (version) - Console.WriteLine ("Mono.Options Localizer Demo 1.0"); + Console.WriteLine ("NDesk.Options Localizer Demo 1.0"); if (verbose > 0) Console.WriteLine ("Message level: {0}", verbose); } @@ -961,21 +972,21 @@ class LocalizationDemo { -v, --verbose increase message verbosity. -n=VALUE must be an int -V, --version output version information and exit. -Mono.Options Localizer Demo 1.0 +NDesk.Options Localizer Demo 1.0 $ LANGUAGE=es mono localization.exe --with-gettext --help --version -h, -?, --help A mostrar este mensaje y salir. -v, --verbose Aumento mensaje verbosidad. -n=VALUE Debe ser un int -V, --version Salida de información de versión y sale. -Mono.Options Localizer Demo 1.0 +NDesk.Options Localizer Demo 1.0 $ mono localization.exe --with-hello --help --version -h, -?, --help hello:show this message and exit. -v, --verbose hello:increase message verbosity. -nhello:=VALUE hello:must be an int -V, --version hello:output version information and exit. -Mono.Options Localizer Demo 1.0 +NDesk.Options Localizer Demo 1.0 $ mono localization.exe -n not-an-int localization: Could not convert string `not-an-int' to type Int32 for option `-n'. @@ -1010,11 +1021,47 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti </Docs> </Member> <Member MemberName="Add"> + <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (Mono.Options.ArgumentSource source);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(class Mono.Options.ArgumentSource source) cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>0.2.2.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>Mono.Options.OptionSet</ReturnType> + </ReturnValue> + <Parameters> + <Parameter Name="source" Type="Mono.Options.ArgumentSource" /> + </Parameters> + <Docs> + <param name="source"> + A <see cref="T:Mono.Options.ArgumentSource" /> to register for + argument processing. + </param> + <summary> + Registers <paramref name="source" /> so that it may be consulted + during argument processing within + <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />. + </summary> + <returns> + The current <see cref="T:Mono.Options.OptionSet" /> instance. + This is to permit method chaining. + </returns> + <remarks> + </remarks> + <exception cref="T:System.ArgumentNullException"> + <paramref name="option" /> is <see langword="null" />. + </exception> + </Docs> + </Member> + <Member MemberName="Add"> <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (Mono.Options.Option option);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(class Mono.Options.Option option) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>Mono.Options.OptionSet</ReturnType> @@ -1054,10 +1101,12 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti </Member> <Member MemberName="Add"> <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (string prototype, Mono.Options.OptionAction<string,string> action);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(string prototype, class Mono.Options.OptionAction`2<string, string> action) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>Mono.Options.OptionSet</ReturnType> @@ -1113,10 +1162,12 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti </Member> <Member MemberName="Add"> <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (string prototype, Action<string> action);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(string prototype, class System.Action`1<string> action) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>Mono.Options.OptionSet</ReturnType> @@ -1172,10 +1223,12 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti </Member> <Member MemberName="Add"> <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (string prototype, string description, Mono.Options.OptionAction<string,string> action);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(string prototype, string description, class Mono.Options.OptionAction`2<string, string> action) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>Mono.Options.OptionSet</ReturnType> @@ -1241,10 +1294,12 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti </Member> <Member MemberName="Add"> <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (string prototype, string description, Action<string> action);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(string prototype, string description, class System.Action`1<string> action) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>Mono.Options.OptionSet</ReturnType> @@ -1300,14 +1355,19 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti </Member> <Member MemberName="Add<T>"> <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add<T> (string prototype, Action<T> action);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add<T>(string prototype, class System.Action`1<!!T> action) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>Mono.Options.OptionSet</ReturnType> </ReturnValue> + <TypeParameters> + <TypeParameter Name="T" /> + </TypeParameters> <Parameters> <Parameter Name="prototype" Type="System.String" /> <Parameter Name="action" Type="System.Action<T>" /> @@ -1353,20 +1413,22 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti a previously registered <see cref="T:Mono.Options.Option" />. </exception> </Docs> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> </Member> <Member MemberName="Add<T>"> <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add<T> (string prototype, string description, Action<T> action);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add<T>(string prototype, string description, class System.Action`1<!!T> action) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>Mono.Options.OptionSet</ReturnType> </ReturnValue> + <TypeParameters> + <TypeParameter Name="T" /> + </TypeParameters> <Parameters> <Parameter Name="prototype" Type="System.String" /> <Parameter Name="description" Type="System.String" /> @@ -1446,20 +1508,23 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti <paramref name="action" /> is <see langword="null" /></para> </exception> </Docs> - <TypeParameters> - <TypeParameter Name="T" /> - </TypeParameters> </Member> <Member MemberName="Add<TKey,TValue>"> <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add<TKey,TValue> (string prototype, Mono.Options.OptionAction<TKey,TValue> action);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add<TKey, TValue>(string prototype, class Mono.Options.OptionAction`2<!!TKey, !!TValue> action) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>Mono.Options.OptionSet</ReturnType> </ReturnValue> + <TypeParameters> + <TypeParameter Name="TKey" /> + <TypeParameter Name="TValue" /> + </TypeParameters> <Parameters> <Parameter Name="prototype" Type="System.String" /> <Parameter Name="action" Type="Mono.Options.OptionAction<TKey,TValue>" /> @@ -1516,21 +1581,23 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti <paramref name="action" /> is <see langword="null" /></para> </exception> </Docs> - <TypeParameters> - <TypeParameter Name="TKey" /> - <TypeParameter Name="TValue" /> - </TypeParameters> </Member> <Member MemberName="Add<TKey,TValue>"> <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add<TKey,TValue> (string prototype, string description, Mono.Options.OptionAction<TKey,TValue> action);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add<TKey, TValue>(string prototype, string description, class Mono.Options.OptionAction`2<!!TKey, !!TValue> action) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>Mono.Options.OptionSet</ReturnType> </ReturnValue> + <TypeParameters> + <TypeParameter Name="TKey" /> + <TypeParameter Name="TValue" /> + </TypeParameters> <Parameters> <Parameter Name="prototype" Type="System.String" /> <Parameter Name="description" Type="System.String" /> @@ -1600,17 +1667,42 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti <paramref name="action" /> is <see langword="null" /></para> </exception> </Docs> - <TypeParameters> - <TypeParameter Name="TKey" /> - <TypeParameter Name="TValue" /> - </TypeParameters> + </Member> + <Member MemberName="ArgumentSources"> + <MemberSignature Language="C#" Value="public System.Collections.ObjectModel.ReadOnlyCollection<Mono.Options.ArgumentSource> ArgumentSources { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ObjectModel.ReadOnlyCollection`1<class Mono.Options.ArgumentSource> ArgumentSources" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>0.2.2.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Collections.ObjectModel.ReadOnlyCollection<Mono.Options.ArgumentSource></ReturnType> + </ReturnValue> + <Docs> + <summary> + A collection of all + <see cref="T:Mono.Options.ArgumentSource" />s which will be consulted during + <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" /> + processing. + </summary> + <value> + A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection{Mono.Options.ArgumentSource}" /> + containing all <see cref="T:Mono.Options.ArgumentSource" />s which + have been + <see cref="M:Mono.Options.OptionSet.Add(Mono.Options.ArgumentSource)" />ed. + </value> + <remarks> + </remarks> + </Docs> </Member> <Member MemberName="CreateOptionContext"> <MemberSignature Language="C#" Value="protected virtual Mono.Options.OptionContext CreateOptionContext ();" /> + <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance class Mono.Options.OptionContext CreateOptionContext() cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>Mono.Options.OptionContext</ReturnType> @@ -1645,9 +1737,11 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti </Member> <Member MemberName="GetKeyForItem"> <MemberSignature Language="C#" Value="protected override string GetKeyForItem (Mono.Options.Option item);" /> + <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance string GetKeyForItem(class Mono.Options.Option item) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.String</ReturnType> @@ -1694,22 +1788,24 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti </Member> <Member MemberName="GetOptionForName"> <MemberSignature Language="C#" Value="protected Mono.Options.Option GetOptionForName (string option);" /> + <MemberSignature Language="ILAsm" Value=".method familyhidebysig instance class Mono.Options.Option GetOptionForName(string option) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> + <Attributes> + <Attribute> + <AttributeName>System.Obsolete("Use KeyedCollection.this[string]")</AttributeName> + </Attribute> + </Attributes> <ReturnValue> <ReturnType>Mono.Options.Option</ReturnType> </ReturnValue> <Parameters> <Parameter Name="option" Type="System.String" /> </Parameters> - <Attributes> - <Attribute> - <AttributeName>System.Obsolete("Use KeyedCollection.this[string]")</AttributeName> - </Attribute> - </Attributes> <Docs> <param name="option"> A <see cref="T:System.String" /> containing the option name to @@ -1740,10 +1836,12 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti </Member> <Member MemberName="GetOptionParts"> <MemberSignature Language="C#" Value="protected bool GetOptionParts (string argument, out string flag, out string name, out string sep, out string value);" /> + <MemberSignature Language="ILAsm" Value=".method familyhidebysig instance bool GetOptionParts(string argument, string flag, string name, string sep, string value) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Boolean</ReturnType> @@ -1832,10 +1930,12 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti </Member> <Member MemberName="InsertItem"> <MemberSignature Language="C#" Value="protected override void InsertItem (int index, Mono.Options.Option item);" /> + <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void InsertItem(int32 index, class Mono.Options.Option item) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Void</ReturnType> @@ -1862,10 +1962,12 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti </Member> <Member MemberName="MessageLocalizer"> <MemberSignature Language="C#" Value="public Converter<string,string> MessageLocalizer { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance class System.Converter`2<string, string> MessageLocalizer" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Converter<System.String,System.String></ReturnType> @@ -1891,10 +1993,12 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti </Member> <Member MemberName="Parse"> <MemberSignature Language="C#" Value="public System.Collections.Generic.List<string> Parse (System.Collections.Generic.IEnumerable<string> arguments);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Collections.Generic.List`1<string> Parse(class System.Collections.Generic.IEnumerable`1<string> arguments) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Collections.Generic.List<System.String></ReturnType> @@ -1918,6 +2022,16 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti </returns> <remarks> <para> + <c>Parse</c> looks at each argument from <paramref name="arguments" /> in order, passing each argument to each + <see cref="T:Mono.Options.ArgumentSource" /> within + <see cref="P:Mono.Options.OptionSet.ArgumentSources" /> using + <see cref="M:Mono.Options.ArgumentSource.GetArguments(System.Int32, System.Collections.Generic.IEnumerable{System.String}@)" /> + until a source returns <see langword="true" /> (and the + replacement sequence is used) or no <c>ArgumentSource</c> supports + the argument. <c>Parse</c> then attempts to process argument as + an option. + </para> + <para> An argument is unhandled if: </para> <list type="bullet"> @@ -1978,7 +2092,7 @@ localization: hello:Could not convert string `not-an-int' to type Int32 for opti </para> <code lang="C#" src="examples/greet.cs">using System; using System.Collections.Generic; -using Mono.Options; +using NDesk.Options; class Test { static int verbosity; @@ -2059,10 +2173,12 @@ class Test { </Member> <Member MemberName="Parse"> <MemberSignature Language="C#" Value="protected virtual bool Parse (string argument, Mono.Options.OptionContext c);" /> + <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance bool Parse(string argument, class Mono.Options.OptionContext c) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Boolean</ReturnType> @@ -2154,10 +2270,12 @@ class Test { </Member> <Member MemberName="RemoveItem"> <MemberSignature Language="C#" Value="protected override void RemoveItem (int index);" /> + <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void RemoveItem(int32 index) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Void</ReturnType> @@ -2180,10 +2298,12 @@ class Test { </Member> <Member MemberName="SetItem"> <MemberSignature Language="C#" Value="protected override void SetItem (int index, Mono.Options.Option item);" /> + <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void SetItem(int32 index, class Mono.Options.Option item) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Void</ReturnType> @@ -2212,10 +2332,12 @@ class Test { </Member> <Member MemberName="WriteOptionDescriptions"> <MemberSignature Language="C#" Value="public void WriteOptionDescriptions (System.IO.TextWriter o);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void WriteOptionDescriptions(class System.IO.TextWriter o) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Void</ReturnType> @@ -2261,6 +2383,12 @@ class Test { more than one value, the leading number is used to specify which value the string is for. </para> + <para> + Once all <see cref="T:Mono.Options.Option" />s have been written, + all <see cref="T:Mono.Options.ArgumentSource" />s are printed out + using <see cref="M:Mono.Options.ArgumentSource.GetNames" /> and + <see cref="P:Mono.Options.ArgumentSource.Description" />. + </para> </remarks> <example> <para> @@ -2271,7 +2399,7 @@ class Test { </para> <code lang="C#" src="examples/greet.cs">using System; using System.Collections.Generic; -using Mono.Options; +using NDesk.Options; class Test { static int verbosity; diff --git a/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionValueCollection.xml b/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionValueCollection.xml index b4dcf59408d..66caf4e4de8 100644 --- a/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionValueCollection.xml +++ b/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionValueCollection.xml @@ -1,15 +1,23 @@ <Type Name="OptionValueCollection" FullName="Mono.Options.OptionValueCollection"> - <TypeSignature Language="C#" Value="public class OptionValueCollection : System.Collections.Generic.IList<string>, System.Collections.IList" /> + <TypeSignature Language="C#" Value="public class OptionValueCollection : System.Collections.Generic.ICollection<string>, System.Collections.Generic.IEnumerable<string>, System.Collections.Generic.IList<string>, System.Collections.IList" /> + <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit OptionValueCollection extends System.Object implements class System.Collections.Generic.ICollection`1<string>, class System.Collections.Generic.IEnumerable`1<string>, class System.Collections.Generic.IList`1<string>, class System.Collections.ICollection, class System.Collections.IEnumerable, class System.Collections.IList" /> <AssemblyInfo> <AssemblyName>Mono.Options</AssemblyName> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <Base> <BaseTypeName>System.Object</BaseTypeName> </Base> <Interfaces> <Interface> + <InterfaceName>System.Collections.Generic.ICollection<System.String></InterfaceName> + </Interface> + <Interface> + <InterfaceName>System.Collections.Generic.IEnumerable<System.String></InterfaceName> + </Interface> + <Interface> <InterfaceName>System.Collections.Generic.IList<System.String></InterfaceName> </Interface> <Interface> @@ -50,10 +58,12 @@ <Members> <Member MemberName="Add"> <MemberSignature Language="C#" Value="public void Add (string item);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Add(string item) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Void</ReturnType> @@ -69,10 +79,12 @@ </Member> <Member MemberName="Clear"> <MemberSignature Language="C#" Value="public void Clear ();" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Clear() cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Void</ReturnType> @@ -85,10 +97,12 @@ </Member> <Member MemberName="Contains"> <MemberSignature Language="C#" Value="public bool Contains (string item);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool Contains(string item) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Boolean</ReturnType> @@ -105,10 +119,12 @@ </Member> <Member MemberName="CopyTo"> <MemberSignature Language="C#" Value="public void CopyTo (string[] array, int arrayIndex);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void CopyTo(string[] array, int32 arrayIndex) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Void</ReturnType> @@ -126,10 +142,12 @@ </Member> <Member MemberName="Count"> <MemberSignature Language="C#" Value="public int Count { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance int32 Count" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Int32</ReturnType> @@ -142,10 +160,12 @@ </Member> <Member MemberName="GetEnumerator"> <MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerator<string> GetEnumerator ();" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Collections.Generic.IEnumerator`1<string> GetEnumerator() cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Collections.Generic.IEnumerator<System.String></ReturnType> @@ -159,10 +179,12 @@ </Member> <Member MemberName="IndexOf"> <MemberSignature Language="C#" Value="public int IndexOf (string item);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance int32 IndexOf(string item) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Int32</ReturnType> @@ -179,10 +201,12 @@ </Member> <Member MemberName="Insert"> <MemberSignature Language="C#" Value="public void Insert (int index, string item);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Insert(int32 index, string item) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Void</ReturnType> @@ -200,10 +224,12 @@ </Member> <Member MemberName="IsReadOnly"> <MemberSignature Language="C#" Value="public bool IsReadOnly { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance bool IsReadOnly" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Boolean</ReturnType> @@ -216,10 +242,12 @@ </Member> <Member MemberName="Item"> <MemberSignature Language="C#" Value="public string this[int index] { set; get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance string Item(int32)" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.String</ReturnType> @@ -236,10 +264,12 @@ </Member> <Member MemberName="Remove"> <MemberSignature Language="C#" Value="public bool Remove (string item);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool Remove(string item) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Boolean</ReturnType> @@ -256,10 +286,12 @@ </Member> <Member MemberName="RemoveAt"> <MemberSignature Language="C#" Value="public void RemoveAt (int index);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void RemoveAt(int32 index) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Void</ReturnType> @@ -275,10 +307,12 @@ </Member> <Member MemberName="System.Collections.ICollection.CopyTo"> <MemberSignature Language="C#" Value="void ICollection.CopyTo (Array array, int index);" /> + <MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.Collections.ICollection.CopyTo(class System.Array array, int32 index) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Void</ReturnType> @@ -296,10 +330,12 @@ </Member> <Member MemberName="System.Collections.ICollection.IsSynchronized"> <MemberSignature Language="C#" Value="bool System.Collections.ICollection.IsSynchronized { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance bool System.Collections.ICollection.IsSynchronized" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Boolean</ReturnType> @@ -312,10 +348,12 @@ </Member> <Member MemberName="System.Collections.ICollection.SyncRoot"> <MemberSignature Language="C#" Value="object System.Collections.ICollection.SyncRoot { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance object System.Collections.ICollection.SyncRoot" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Object</ReturnType> @@ -328,10 +366,12 @@ </Member> <Member MemberName="System.Collections.IEnumerable.GetEnumerator"> <MemberSignature Language="C#" Value="System.Collections.IEnumerator IEnumerable.GetEnumerator ();" /> + <MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance class System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Collections.IEnumerator</ReturnType> @@ -345,10 +385,12 @@ </Member> <Member MemberName="System.Collections.IList.Add"> <MemberSignature Language="C#" Value="int IList.Add (object value);" /> + <MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance int32 System.Collections.IList.Add(object value) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Int32</ReturnType> @@ -365,10 +407,12 @@ </Member> <Member MemberName="System.Collections.IList.Contains"> <MemberSignature Language="C#" Value="bool IList.Contains (object value);" /> + <MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance bool System.Collections.IList.Contains(object value) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Boolean</ReturnType> @@ -385,10 +429,12 @@ </Member> <Member MemberName="System.Collections.IList.IndexOf"> <MemberSignature Language="C#" Value="int IList.IndexOf (object value);" /> + <MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance int32 System.Collections.IList.IndexOf(object value) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Int32</ReturnType> @@ -405,10 +451,12 @@ </Member> <Member MemberName="System.Collections.IList.Insert"> <MemberSignature Language="C#" Value="void IList.Insert (int index, object value);" /> + <MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.Collections.IList.Insert(int32 index, object value) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Void</ReturnType> @@ -426,10 +474,12 @@ </Member> <Member MemberName="System.Collections.IList.IsFixedSize"> <MemberSignature Language="C#" Value="bool System.Collections.IList.IsFixedSize { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance bool System.Collections.IList.IsFixedSize" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Boolean</ReturnType> @@ -442,10 +492,12 @@ </Member> <Member MemberName="System.Collections.IList.Item"> <MemberSignature Language="C#" Value="object System.Collections.IList.Item[int index] { set; get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance object System.Collections.IList.Item(int32)" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Object</ReturnType> @@ -462,10 +514,12 @@ </Member> <Member MemberName="System.Collections.IList.Remove"> <MemberSignature Language="C#" Value="void IList.Remove (object value);" /> + <MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.Collections.IList.Remove(object value) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Void</ReturnType> @@ -481,10 +535,12 @@ </Member> <Member MemberName="System.Collections.IList.RemoveAt"> <MemberSignature Language="C#" Value="void IList.RemoveAt (int index);" /> + <MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.Collections.IList.RemoveAt(int32 index) cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Void</ReturnType> @@ -500,10 +556,12 @@ </Member> <Member MemberName="ToArray"> <MemberSignature Language="C#" Value="public string[] ToArray ();" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig instance string[] ToArray() cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.String[]</ReturnType> @@ -517,10 +575,12 @@ </Member> <Member MemberName="ToList"> <MemberSignature Language="C#" Value="public System.Collections.Generic.List<string> ToList ();" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Collections.Generic.List`1<string> ToList() cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.Collections.Generic.List<System.String></ReturnType> @@ -534,10 +594,12 @@ </Member> <Member MemberName="ToString"> <MemberSignature Language="C#" Value="public override string ToString ();" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance string ToString() cil managed" /> <MemberType>Method</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.String</ReturnType> diff --git a/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionValueType.xml b/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionValueType.xml index 6f6f62c9007..aa035c500d6 100644 --- a/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionValueType.xml +++ b/mcs/class/Mono.Options/Documentation/en/Mono.Options/OptionValueType.xml @@ -1,9 +1,11 @@ <Type Name="OptionValueType" FullName="Mono.Options.OptionValueType"> <TypeSignature Language="C#" Value="public enum OptionValueType" /> + <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed OptionValueType extends System.Enum" /> <AssemblyInfo> <AssemblyName>Mono.Options</AssemblyName> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <Base> <BaseTypeName>System.Enum</BaseTypeName> @@ -20,10 +22,12 @@ <Members> <Member MemberName="None"> <MemberSignature Language="C#" Value="None" /> + <MemberSignature Language="ILAsm" Value=".field public static literal valuetype Mono.Options.OptionValueType None = int32(0)" /> <MemberType>Field</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>Mono.Options.OptionValueType</ReturnType> @@ -41,10 +45,12 @@ </Member> <Member MemberName="Optional"> <MemberSignature Language="C#" Value="Optional" /> + <MemberSignature Language="ILAsm" Value=".field public static literal valuetype Mono.Options.OptionValueType Optional = int32(1)" /> <MemberType>Field</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>Mono.Options.OptionValueType</ReturnType> @@ -67,10 +73,12 @@ </Member> <Member MemberName="Required"> <MemberSignature Language="C#" Value="Required" /> + <MemberSignature Language="ILAsm" Value=".field public static literal valuetype Mono.Options.OptionValueType Required = int32(2)" /> <MemberType>Field</MemberType> <AssemblyInfo> <AssemblyVersion>0.2.0.0</AssemblyVersion> <AssemblyVersion>0.2.1.0</AssemblyVersion> + <AssemblyVersion>0.2.2.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>Mono.Options.OptionValueType</ReturnType> diff --git a/mcs/class/Mono.Options/Documentation/en/Mono.Options/ResponseFileSource.xml b/mcs/class/Mono.Options/Documentation/en/Mono.Options/ResponseFileSource.xml new file mode 100644 index 00000000000..f97cb570494 --- /dev/null +++ b/mcs/class/Mono.Options/Documentation/en/Mono.Options/ResponseFileSource.xml @@ -0,0 +1,134 @@ +<Type Name="ResponseFileSource" FullName="Mono.Options.ResponseFileSource"> + <TypeSignature Language="C#" Value="public class ResponseFileSource : Mono.Options.ArgumentSource" /> + <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ResponseFileSource extends Mono.Options.ArgumentSource" /> + <AssemblyInfo> + <AssemblyName>Mono.Options</AssemblyName> + <AssemblyVersion>0.2.2.0</AssemblyVersion> + </AssemblyInfo> + <Base> + <BaseTypeName>Mono.Options.ArgumentSource</BaseTypeName> + </Base> + <Interfaces /> + <Docs> + <summary> + Inserts the contents of a file during argument processing. + </summary> + <remarks> + <para> + <c>ResponseFileSource</c> looks for arguments which start with + <c>@</c>, assumes that what follows the <c>@</c> is a valid filename, + and reads the contents of the filename as the replacement text. + </para> + </remarks> + </Docs> + <Members> + <Member MemberName=".ctor"> + <MemberSignature Language="C#" Value="public ResponseFileSource ();" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> + <MemberType>Constructor</MemberType> + <AssemblyInfo> + <AssemblyVersion>0.2.2.0</AssemblyVersion> + </AssemblyInfo> + <Parameters /> + <Docs> + <summary> + Constructs and initializes a + <see cref="T:Mono.Options.ResponseFileSource" /> instance. + </summary> + <remarks> + </remarks> + </Docs> + </Member> + <Member MemberName="Description"> + <MemberSignature Language="C#" Value="public override string Description { get; }" /> + <MemberSignature Language="ILAsm" Value=".property instance string Description" /> + <MemberType>Property</MemberType> + <AssemblyInfo> + <AssemblyVersion>0.2.2.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.String</ReturnType> + </ReturnValue> + <Docs> + <summary> + The description to provide for the argument source within + <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions(System.IO.TextWriter)" />. + </summary> + <value> + <c>"Read response file for more options."</c>. + </value> + <remarks> + </remarks> + </Docs> + </Member> + <Member MemberName="GetArguments"> + <MemberSignature Language="C#" Value="public override bool GetArguments (string value, out System.Collections.Generic.IEnumerable<string> replacement);" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance bool GetArguments(string value, class System.Collections.Generic.IEnumerable`1<string> replacement) cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>0.2.2.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.Boolean</ReturnType> + </ReturnValue> + <Parameters> + <Parameter Name="value" Type="System.String" /> + <Parameter Name="replacement" Type="System.Collections.Generic.IEnumerable<System.String>&" RefType="out" /> + </Parameters> + <Docs> + <param name="value"> + A <see cref="T:System.String" /> containing the argument to replace + with additional arguments. + </param> + <param name="replacement"> + A <see cref="T:System.Collections.Generic.IEnumerable{System.String}" /> + which will refer to teh replacement arguments if this method returns + <see langword="true" />; otherwise, this value should be ignored by + callers. + </param> + <summary> + Replace the argument <paramref name="value" /> with the contents of + the specified file. + </summary> + <returns> + If <paramref name="value" /> starts with <c>@</c>, then + <paramref name="replacement" /> will contain the parsed contents of + the filename resulting from <c><paramref name="value" />.Substring(1)</c> + and <see langword="true" /> is returned; otherwise, + <see langword="false" /> is returned. + </returns> + <remarks> + </remarks> + <exception cref="T:System.IO.IOException"> + <paramref name="value" /> starts with <c>@</c> and + <c><paramref name="value" />.Substring(1)</c> doees not exist. + </exception> + <altmember cref="M:Mono.Options.ArgumentSource.GetArgumentsFromFile(System.String)" /> + </Docs> + </Member> + <Member MemberName="GetNames"> + <MemberSignature Language="C#" Value="public override string[] GetNames ();" /> + <MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance string[] GetNames() cil managed" /> + <MemberType>Method</MemberType> + <AssemblyInfo> + <AssemblyVersion>0.2.2.0</AssemblyVersion> + </AssemblyInfo> + <ReturnValue> + <ReturnType>System.String[]</ReturnType> + </ReturnValue> + <Parameters /> + <Docs> + <summary> + The names to provide for the argument source within + <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions(System.IO.TextWriter)" />. + </summary> + <returns> + A <see cref="T:System.String" /> array containing + an element with the value <c>"@file"</c>. + </returns> + <remarks> + </remarks> + </Docs> + </Member> + </Members> +</Type> diff --git a/mcs/class/Mono.Options/Documentation/en/index.xml b/mcs/class/Mono.Options/Documentation/en/index.xml index f02c2392dc7..81b20539176 100644 --- a/mcs/class/Mono.Options/Documentation/en/index.xml +++ b/mcs/class/Mono.Options/Documentation/en/index.xml @@ -3,28 +3,30 @@ <Remarks>Program option parser.</Remarks> <Copyright>2008 Novell, Inc.</Copyright> <Assemblies> - <Assembly Name="Mono.Options" Version="0.2.1.0"> + <Assembly Name="Mono.Options" Version="0.2.2.0"> + <AssemblyPublicKey>[00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 79 15 99 77 d2 d0 3a 8e 6b ea 7a 2e 74 e8 d1 af cc 93 e8 85 19 74 95 2b b4 80 a1 2c 91 34 47 4d 04 06 24 47 c3 7e 0e 68 c0 80 53 6f cf 3c 3f be 2f f9 c9 79 ce 99 84 75 e5 06 e8 ce 82 dd 5b 0f 35 0d c1 0e 93 bf 2e ee cf 87 4b 24 77 0c 50 81 db ea 74 47 fd da fa 27 7b 22 de 47 d6 ff ea 44 96 74 a4 f9 fc cf 84 d1 50 69 08 93 80 28 4d bd d3 5f 46 cd ff 12 a1 bd 78 e4 ef 00 65 d0 16 df ]</AssemblyPublicKey> <Attributes> <Attribute> - <AttributeName>System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true)</AttributeName> + <AttributeName>System.CLSCompliant(true)</AttributeName> </Attribute> <Attribute> - <AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName> + <AttributeName>System.Reflection.AssemblyDescription("Command Line Parsing Utilities")</AttributeName> </Attribute> <Attribute> - <AttributeName>System.CLSCompliant(true)</AttributeName> + <AttributeName>System.Reflection.AssemblyTitle("Mono.Options.dll")</AttributeName> </Attribute> <Attribute> - <AttributeName>System.Reflection.AssemblyDescription("Command Line Parsing Utilities")</AttributeName> + <AttributeName>System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true)</AttributeName> </Attribute> <Attribute> - <AttributeName>System.Reflection.AssemblyTitle("Mono.Options.dll")</AttributeName> + <AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName> </Attribute> </Attributes> </Assembly> </Assemblies> <Types> <Namespace Name="Mono.Options"> + <Type Name="ArgumentSource" Kind="Class" /> <Type Name="Option" Kind="Class" /> <Type Name="OptionAction`2" DisplayName="OptionAction<TKey,TValue>" Kind="Delegate" /> <Type Name="OptionContext" Kind="Class" /> @@ -32,6 +34,7 @@ <Type Name="OptionSet" Kind="Class" /> <Type Name="OptionValueCollection" Kind="Class" /> <Type Name="OptionValueType" Kind="Enumeration" /> + <Type Name="ResponseFileSource" Kind="Class" /> </Namespace> </Types> </Overview> diff --git a/mcs/class/Mono.Options/Mono.Options/Options.cs b/mcs/class/Mono.Options/Mono.Options/Options.cs index 6c2df9aee9f..b9b48a96722 100644 --- a/mcs/class/Mono.Options/Mono.Options/Options.cs +++ b/mcs/class/Mono.Options/Mono.Options/Options.cs @@ -544,6 +544,92 @@ namespace Mono.Options } } + public abstract class ArgumentSource { + + protected ArgumentSource () + { + } + + public abstract string[] GetNames (); + public abstract string Description { get; } + public abstract bool GetArguments (string value, out IEnumerable<string> replacement); + + public static IEnumerable<string> GetArgumentsFromFile (string file) + { + return GetArguments (File.OpenText (file), true); + } + + public static IEnumerable<string> GetArguments (TextReader reader) + { + return GetArguments (reader, false); + } + + // Cribbed from mcs/driver.cs:LoadArgs(string) + static IEnumerable<string> GetArguments (TextReader reader, bool close) + { + try { + StringBuilder arg = new StringBuilder (); + + string line; + while ((line = reader.ReadLine ()) != null) { + int t = line.Length; + + for (int i = 0; i < t; i++) { + char c = line [i]; + + if (c == '"' || c == '\'') { + char end = c; + + for (i++; i < t; i++){ + c = line [i]; + + if (c == end) + break; + arg.Append (c); + } + } else if (c == ' ') { + if (arg.Length > 0) { + yield return arg.ToString (); + arg.Length = 0; + } + } else + arg.Append (c); + } + if (arg.Length > 0) { + yield return arg.ToString (); + arg.Length = 0; + } + } + } + finally { + if (close) + reader.Close (); + } + } + } + + public class ResponseFileSource : ArgumentSource { + + public override string[] GetNames () + { + return new string[]{"@file"}; + } + + public override string Description { + get {return "Read response file for more options.";} + } + + public override bool GetArguments (string value, out IEnumerable<string> replacement) + { + if (string.IsNullOrEmpty (value) || !value.StartsWith ("@")) { + replacement = null; + return false; + } + replacement = ArgumentSource.GetArgumentsFromFile (value.Substring (1)); + return true; + } + } + [Serializable] public class OptionException : Exception { private string option; @@ -594,6 +680,7 @@ namespace Mono.Options public OptionSet (Converter<string, string> localizer) { this.localizer = localizer; + this.roSources = new ReadOnlyCollection<ArgumentSource>(sources); } Converter<string, string> localizer; @@ -602,6 +689,14 @@ namespace Mono.Options get {return localizer;} } + List<ArgumentSource> sources = new List<ArgumentSource> (); + ReadOnlyCollection<ArgumentSource> roSources; + + public ReadOnlyCollection<ArgumentSource> ArgumentSources { + get {return roSources;} + } + + protected override string GetKeyForItem (Option item) { if (item == null) @@ -776,48 +871,30 @@ namespace Mono.Options return Add (new ActionOption<TKey, TValue> (prototype, description, action)); } - protected virtual OptionContext CreateOptionContext () + public OptionSet Add (ArgumentSource source) { - return new OptionContext (this); + if (source == null) + throw new ArgumentNullException ("source"); + sources.Add (source); + return this; } -#if LINQ - public List<string> Parse (IEnumerable<string> arguments) + protected virtual OptionContext CreateOptionContext () { - bool process = true; - OptionContext c = CreateOptionContext (); - c.OptionIndex = -1; - var def = GetOptionForName ("<>"); - var unprocessed = - from argument in arguments - where ++c.OptionIndex >= 0 && (process || def != null) - ? process - ? argument == "--" - ? (process = false) - : !Parse (argument, c) - ? def != null - ? Unprocessed (null, def, c, argument) - : true - : false - : def != null - ? Unprocessed (null, def, c, argument) - : true - : true - select argument; - List<string> r = unprocessed.ToList (); - if (c.Option != null) - c.Option.Invoke (c); - return r; + return new OptionContext (this); } -#else + public List<string> Parse (IEnumerable<string> arguments) { + if (arguments == null) + throw new ArgumentNullException ("arguments"); OptionContext c = CreateOptionContext (); c.OptionIndex = -1; bool process = true; List<string> unprocessed = new List<string> (); Option def = Contains ("<>") ? this ["<>"] : null; - foreach (string argument in arguments) { + ArgumentEnumerator ae = new ArgumentEnumerator (arguments); + foreach (string argument in ae) { ++c.OptionIndex; if (argument == "--") { process = false; @@ -827,6 +904,8 @@ namespace Mono.Options Unprocessed (unprocessed, def, c, argument); continue; } + if (AddSource (ae, argument)) + continue; if (!Parse (argument, c)) Unprocessed (unprocessed, def, c, argument); } @@ -834,7 +913,48 @@ namespace Mono.Options c.Option.Invoke (c); return unprocessed; } -#endif + + class ArgumentEnumerator : IEnumerable<string> { + List<IEnumerator<string>> sources = new List<IEnumerator<string>> (); + + public ArgumentEnumerator (IEnumerable<string> arguments) + { + sources.Add (arguments.GetEnumerator ()); + } + + public void Add (IEnumerable<string> arguments) + { + sources.Add (arguments.GetEnumerator ()); + } + + public IEnumerator<string> GetEnumerator () + { + do { + IEnumerator<string> c = sources [sources.Count-1]; + if (c.MoveNext ()) + yield return c.Current; + else + sources.RemoveAt (sources.Count-1); + } while (sources.Count > 0); + } + + IEnumerator IEnumerable.GetEnumerator () + { + return GetEnumerator (); + } + } + + bool AddSource (ArgumentEnumerator ae, string argument) + { + foreach (ArgumentSource source in sources) { + IEnumerable<string> replacement; + if (!source.GetArguments (argument, out replacement)) + continue; + ae.Add (replacement); + return true; + } + return false; + } private static bool Unprocessed (ICollection<string> extra, Option def, OptionContext c, string argument) { @@ -1011,6 +1131,37 @@ namespace Mono.Options indent = true; } } + + foreach (ArgumentSource s in sources) { + string[] names = s.GetNames (); + if (names == null || names.Length == 0) + continue; + + int written = 0; + + Write (o, ref written, " "); + Write (o, ref written, names [0]); + for (int i = 1; i < names.Length; ++i) { + Write (o, ref written, ", "); + Write (o, ref written, names [i]); + } + + if (written < OptionWidth) + o.Write (new string (' ', OptionWidth - written)); + else { + o.WriteLine (); + o.Write (new string (' ', OptionWidth)); + } + + bool indent = false; + string prefix = new string (' ', OptionWidth+2); + foreach (string line in GetLines (localizer (GetDescription (s.Description)))) { + if (indent) + o.Write (prefix); + o.WriteLine (line); + indent = true; + } + } } bool WriteOptionPrototype (TextWriter o, Option p, ref int written) diff --git a/mcs/class/Mono.Options/Test/Mono.Options/OptionSetTest.cs b/mcs/class/Mono.Options/Test/Mono.Options/OptionSetTest.cs index 0d9af0be576..0d1433cdce6 100644 --- a/mcs/class/Mono.Options/Test/Mono.Options/OptionSetTest.cs +++ b/mcs/class/Mono.Options/Test/Mono.Options/OptionSetTest.cs @@ -27,6 +27,7 @@ // using System; +using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; @@ -80,6 +81,52 @@ namespace Tests.Mono.Options public override string ToString () {return s;} } + class TestArgumentSource : ArgumentSource, IEnumerable { + string[] names; + string desc; + + public TestArgumentSource (string[] names, string desc) + { + this.names = names; + this.desc = desc; + } + + Dictionary<string, string[]> args = new Dictionary<string, string[]>(); + + public void Add (string key, params string[] values) + { + args.Add (key, values); + } + + public override string[] GetNames () + { + return names; + } + + public override string Description { + get {return desc;} + } + + public override bool GetArguments (string value, out IEnumerable<string> replacement) + { + replacement = null; + + string[] values; + if (args.TryGetValue (value, out values)) { + replacement = values; + return true; + } + + return false; + } + + + IEnumerator IEnumerable.GetEnumerator () + { + return args.GetEnumerator (); + } + } + [TestFixture] public class OptionSetTest : ListContract<Option> { @@ -114,6 +161,12 @@ namespace Tests.Mono.Options [Test] public void BundledValues () { + BundledValues (_("-DNAME", "-D", "NAME2", "-Debug", "-L/foo", "-L", "/bar", "-EDNAME3")); + BundledValues (_("@s1", "-D", "@s2", "-L/foo", "@s4")); + } + + public void BundledValues (IEnumerable<string> args) + { var defines = new List<string> (); var libs = new List<string> (); bool debug = false; @@ -122,8 +175,14 @@ namespace Tests.Mono.Options { "L|library:", v => libs.Add (v) }, { "Debug", v => debug = v != null }, { "E", v => { /* ignore */ } }, + new TestArgumentSource (null, null) { + { "@s1", "-DNAME" }, + { "@s2", "NAME2", "@s3" }, + { "@s3", "-Debug" }, + { "@s4", "-L", "/bar", "-EDNAME3" }, + }, }; - p.Parse (_("-DNAME", "-D", "NAME2", "-Debug", "-L/foo", "-L", "/bar", "-EDNAME3")); + p.Parse (args); Assert.AreEqual (defines.Count, 3); Assert.AreEqual (defines [0], "NAME"); Assert.AreEqual (defines [1], "NAME2"); @@ -141,13 +200,23 @@ namespace Tests.Mono.Options [Test] public void RequiredValues () { + RequiredValues (_("a", "-a", "s", "-n=42", "n")); + RequiredValues (_("@s1", "s", "@s2", "n")); + } + + void RequiredValues (IEnumerable<string> args) + { string a = null; int n = 0; OptionSet p = new OptionSet () { { "a=", v => a = v }, { "n=", (int v) => n = v }, + new TestArgumentSource (null, null) { + { "@s1", "a", "-a" }, + { "@s2", "-n=42" }, + }, }; - List<string> extra = p.Parse (_("a", "-a", "s", "-n=42", "n")); + List<string> extra = p.Parse (args); Assert.AreEqual (extra.Count, 2); Assert.AreEqual (extra [0], "a"); Assert.AreEqual (extra [1], "n"); @@ -218,6 +287,13 @@ namespace Tests.Mono.Options [Test] public void CombinationPlatter () { + CombinationPlatter (new string[]{"foo", "-v", "-a=42", "/b-", + "-a", "64", "bar", "--f", "B", "/h", "-?", "--help", "-v"}); + CombinationPlatter (_("@s1", "-a=42", "@s3", "-a", "64", "bar", "@s4")); + } + + void CombinationPlatter (IEnumerable<string> args) + { int a = -1, b = -1; string av = null, bv = null; Foo f = null; @@ -233,9 +309,14 @@ namespace Tests.Mono.Options case "?": help |= 0x2; break; case "help": help |= 0x4; break; } } }, + new TestArgumentSource (null, null) { + { "@s1", "foo", "-v", "@s2" }, + { "@s2" }, + { "@s3", "/b-" }, + { "@s4", "--f", "B", "/h", "-?", "--help", "-v" }, + }, }; - List<string> e = p.Parse (new string[]{"foo", "-v", "-a=42", "/b-", - "-a", "64", "bar", "--f", "B", "/h", "-?", "--help", "-v"}); + List<string> e = p.Parse (args); Assert.AreEqual (e.Count, 2); Assert.AreEqual (e[0], "foo"); @@ -274,7 +355,7 @@ namespace Tests.Mono.Options Assert.AreEqual (a, "-b"); Utils.AssertException (typeof(ArgumentNullException), "Argument cannot be null.\nParameter name: option", - p, v => { v.Add (null); }); + p, v => { v.Add ((Option) null); }); // bad type Utils.AssertException (typeof(OptionException), @@ -333,6 +414,7 @@ namespace Tests.Mono.Options { "h|?|help", "show help text", v => {} }, { "version", "output version information and exit", v => {} }, { "<>", v => {} }, + new TestArgumentSource (new[]{"@s1", "@s2"}, "Read Response File for More Options"), }; StringWriter expected = new StringWriter (); @@ -366,6 +448,7 @@ namespace Tests.Mono.Options expected.WriteLine (" `dirname FILE`/cache/`basename FILE .tree`."); expected.WriteLine (" -h, -?, --help show help text"); expected.WriteLine (" --version output version information and exit"); + expected.WriteLine (" @s1, @s2 Read Response File for More Options"); StringWriter actual = new StringWriter (); p.WriteOptionDescriptions (actual); @@ -376,6 +459,12 @@ namespace Tests.Mono.Options [Test] public void OptionBundling () { + OptionBundling (_ ("-abcf", "foo", "bar")); + OptionBundling (_ ("@s1", "foo", "bar")); + } + + void OptionBundling (IEnumerable<string> args) + { string a, b, c, f; a = b = c = f = null; var p = new OptionSet () { @@ -383,8 +472,11 @@ namespace Tests.Mono.Options { "b", v => b = "b" }, { "c", v => c = "c" }, { "f=", v => f = v }, + new TestArgumentSource (null, null) { + { "@s1", "-abcf" }, + }, }; - List<string> extra = p.Parse (_ ("-abcf", "foo", "bar")); + List<string> extra = p.Parse (args); Assert.AreEqual (extra.Count, 1); Assert.AreEqual (extra [0], "bar"); Assert.AreEqual (a, "a"); @@ -399,11 +491,18 @@ namespace Tests.Mono.Options var p = new OptionSet () { { "a", v => {} }, { "b", v => {} }, + new TestArgumentSource (null, null) { + { "@s1", "-a", "-b" }, + }, }; List<string> e = p.Parse (_ ("-a", "-b", "--", "-a", "-b")); Assert.AreEqual (e.Count, 2); Assert.AreEqual (e [0], "-a"); Assert.AreEqual (e [1], "-b"); + + e = p.Parse (_ ("@s1", "--", "@s1")); + Assert.AreEqual (e.Count, 1); + Assert.AreEqual (e [0], "@s1"); } [Test] @@ -418,19 +517,42 @@ namespace Tests.Mono.Options { "d={=>}{-->}", (k, v) => a.Add (k, v) }, { "e={}", (k, v) => a.Add (k, v) }, { "f=+/", (k, v) => a.Add (k, v) }, + new TestArgumentSource (null, null) { + { "@s1", "-a", "A" }, + { "@s2", @"C:\tmp", "-a" }, + { "@s3", "C=D", @"-a=E=F:\tmp" }, + { "@s4", "-a:G:H", "-aI=J" }, + { "@s5", "-b", "1" }, + { "@s6", "a", "-b" }, + { "@s7", "2", "b" }, + { "@s8", "-dA=>B", "-d" }, + { "@s9", "C-->D", "-d:E" }, + { "@s10", "F", "-d" }, + { "@s11", "G", "H" }, + { "@s12", "-dJ-->K" } + }, }; p.Parse (_("-a", "A", @"C:\tmp", "-a", "C=D", @"-a=E=F:\tmp", "-a:G:H", "-aI=J", "-b", "1", "a", "-b", "2", "b")); - AssertDictionary (a, - "A", @"C:\tmp", - "C", "D", - "E", @"F:\tmp", - "G", "H", - "I", "J"); - AssertDictionary (b, - "1", "a", - "2", "b"); + Action assert = () => { + AssertDictionary (a, + "A", @"C:\tmp", + "C", "D", + "E", @"F:\tmp", + "G", "H", + "I", "J"); + AssertDictionary (b, + "1", "a", + "2", "b"); + }; + assert (); + a.Clear (); + b.Clear (); + p.Parse (_("@s1", "@s2", "@s3", "@s4", "@s5", "@s6", "@s7")); + assert (); a.Clear (); + b.Clear (); + p.Parse (_("-c")); Assert.AreEqual (a.Count, 0); p.Parse (_("-c", "a")); @@ -443,14 +565,21 @@ namespace Tests.Mono.Options a.Clear (); p.Parse (_("-dA=>B", "-d", "C-->D", "-d:E", "F", "-d", "G", "H", "-dJ-->K")); - AssertDictionary (a, - "A", "B", - "C", "D", - "E", "F", - "G", "H", - "J", "K"); + assert = () => { + AssertDictionary (a, + "A", "B", + "C", "D", + "E", "F", + "G", "H", + "J", "K"); + }; + assert (); + a.Clear (); + p.Parse (_("@s8", "@s9", "@s10", "@s11", "@s12")); + assert (); a.Clear (); + p.Parse (_("-eA=B", "-eC=D", "-eE", "F", "-e:G", "H")); AssertDictionary (a, "A=B", "-eC=D", |