You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.167
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
parent
e49d6f06c0
commit
536cd135cc
@ -250,8 +250,8 @@ commands: Use `commands help` for usage.
|
||||
</Docs>
|
||||
<Members>
|
||||
<Member MemberName=".ctor">
|
||||
<MemberSignature Language="C#" Value="public CommandSet (string suite, Converter<string,string> localizer = null, System.IO.TextWriter output = null, System.IO.TextWriter error = null);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string suite, class System.Converter`2<string, string> localizer, class System.IO.TextWriter output, class System.IO.TextWriter error) cil managed" />
|
||||
<MemberSignature Language="C#" Value="public CommandSet (string suite, Converter<string,string> localizer = null);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string suite, class System.Converter`2<string, string> localizer) cil managed" />
|
||||
<MemberType>Constructor</MemberType>
|
||||
<AssemblyInfo>
|
||||
<AssemblyVersion>0.2.3.0</AssemblyVersion>
|
||||
@ -259,8 +259,6 @@ commands: Use `commands help` for usage.
|
||||
<Parameters>
|
||||
<Parameter Name="suite" Type="System.String" />
|
||||
<Parameter Name="localizer" Type="System.Converter<System.String,System.String>" />
|
||||
<Parameter Name="output" Type="System.IO.TextWriter" />
|
||||
<Parameter Name="error" Type="System.IO.TextWriter" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="suite">
|
||||
@ -272,15 +270,57 @@ commands: Use `commands help` for usage.
|
||||
instance that will be used to translate strings.
|
||||
If <see langword="null" />, then no localization is performed.
|
||||
</param>
|
||||
<summary>
|
||||
Creates and initializes a new <c>CommandSet</c> instance.
|
||||
</summary>
|
||||
<remarks>
|
||||
<para>
|
||||
This constructor initializes
|
||||
the <see cref="P:Mono.Options.CommandSet.Suite" /> property
|
||||
of the new instance using <paramref name="suite" />,
|
||||
the <see cref="P:Mono.Options.CommandSet.MessageLocalizer" /> property
|
||||
of the new instance using <paramref name="localizer" />,
|
||||
the <see cref="P:Mono.Options.CommandSet.Out" /> property
|
||||
to <see cref="P:System.Console.Out" />, and
|
||||
the <see cref="P:Mono.Options.CommandSet.Error" /> property
|
||||
to <see cref="P:System.Console.Error" />.
|
||||
</para>
|
||||
</remarks>
|
||||
<exception cref="T:System.ArgumentNullException">
|
||||
<paramref name="suite" /> is <see langword="null" />.
|
||||
</exception>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName=".ctor">
|
||||
<MemberSignature Language="C#" Value="public CommandSet (string suite, System.IO.TextWriter output, System.IO.TextWriter error, Converter<string,string> localizer = null);" />
|
||||
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string suite, class System.IO.TextWriter output, class System.IO.TextWriter error, class System.Converter`2<string, string> localizer) cil managed" />
|
||||
<MemberType>Constructor</MemberType>
|
||||
<AssemblyInfo>
|
||||
<AssemblyVersion>0.2.3.0</AssemblyVersion>
|
||||
</AssemblyInfo>
|
||||
<Parameters>
|
||||
<Parameter Name="suite" Type="System.String" />
|
||||
<Parameter Name="output" Type="System.IO.TextWriter" />
|
||||
<Parameter Name="error" Type="System.IO.TextWriter" />
|
||||
<Parameter Name="localizer" Type="System.Converter<System.String,System.String>" />
|
||||
</Parameters>
|
||||
<Docs>
|
||||
<param name="suite">
|
||||
A <see cref="T:System.String" /> containing the name of the suite.
|
||||
This value is used in default <c>help</c> text output.
|
||||
</param>
|
||||
<param name="output">
|
||||
A <see cref="T:System.IO.TextWriter" /> where output messages will be
|
||||
written to. If <see langword="null" />, then the
|
||||
<see cref="P:System.Console.Out" /> property will be used.
|
||||
written to.
|
||||
</param>
|
||||
<param name="error">
|
||||
A <see cref="T:System.IO.TextWriter" /> where error messages will be
|
||||
written to. If <see langword="null" />, then the
|
||||
<see cref="P:System.Console.Error" /> property will be used.
|
||||
written to.
|
||||
</param>
|
||||
<param name="localizer">
|
||||
A <see cref="T:System.Converter{System.String,System.String}" />
|
||||
instance that will be used to translate strings.
|
||||
If <see langword="null" />, then no localization is performed.
|
||||
</param>
|
||||
<summary>
|
||||
Creates and initializes a new <c>CommandSet</c> instance.
|
||||
@ -301,6 +341,12 @@ commands: Use `commands help` for usage.
|
||||
<exception cref="T:System.ArgumentNullException">
|
||||
<paramref name="suite" /> is <see langword="null" />.
|
||||
</exception>
|
||||
<exception cref="T:System.ArgumentNullException">
|
||||
<paramref name="output" /> is <see langword="null" />.
|
||||
</exception>
|
||||
<exception cref="T:System.ArgumentNullException">
|
||||
<paramref name="error" /> is <see langword="null" />.
|
||||
</exception>
|
||||
</Docs>
|
||||
</Member>
|
||||
<Member MemberName="Add">
|
||||
|
@ -162,10 +162,10 @@ using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
#if PCL
|
||||
using System.Reflection;
|
||||
#else
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
#endif
|
||||
using System.Text;
|
||||
@ -634,7 +634,7 @@ namespace Mono.Options
|
||||
public abstract string Description { get; }
|
||||
public abstract bool GetArguments (string value, out IEnumerable<string> replacement);
|
||||
|
||||
#if !PCL
|
||||
#if !PCL || NETSTANDARD1_3
|
||||
public static IEnumerable<string> GetArgumentsFromFile (string file)
|
||||
{
|
||||
return GetArguments (File.OpenText (file), true);
|
||||
@ -690,7 +690,7 @@ namespace Mono.Options
|
||||
}
|
||||
}
|
||||
|
||||
#if !PCL
|
||||
#if !PCL || NETSTANDARD1_3
|
||||
public class ResponseFileSource : ArgumentSource {
|
||||
|
||||
public override string[] GetNames ()
|
||||
@ -1586,14 +1586,26 @@ namespace Mono.Options
|
||||
|
||||
internal OptionSet Options => options;
|
||||
|
||||
public CommandSet (string suite, MessageLocalizerConverter localizer = null, TextWriter output = null, TextWriter error = null)
|
||||
#if !PCL || NETSTANDARD1_3
|
||||
public CommandSet(string suite, MessageLocalizerConverter localizer = null)
|
||||
: this(suite, Console.Out, Console.Error, localizer)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
public CommandSet (string suite, TextWriter output, TextWriter error, MessageLocalizerConverter localizer = null)
|
||||
{
|
||||
if (suite == null)
|
||||
throw new ArgumentNullException (nameof (suite));
|
||||
if (output == null)
|
||||
throw new ArgumentNullException (nameof (output));
|
||||
if (error == null)
|
||||
throw new ArgumentNullException (nameof (error));
|
||||
|
||||
this.suite = suite;
|
||||
options = new CommandOptionSet (this, localizer);
|
||||
outWriter = output ?? Console.Out;
|
||||
errorWriter = error ?? Console.Error;
|
||||
outWriter = output;
|
||||
errorWriter = error;
|
||||
}
|
||||
|
||||
public string Suite => suite;
|
||||
|
@ -228,7 +228,7 @@ namespace MonoTests.Mono.Options
|
||||
e.Run = (args) => e.CommandSet.Out.WriteLine (string.Join (" ", args));
|
||||
|
||||
var o = new StringWriter ();
|
||||
var c = new CommandSet ("set", output:o) {
|
||||
var c = new CommandSet ("set", output:o, error: Console.Error) {
|
||||
e,
|
||||
};
|
||||
Assert.AreEqual (0, c.Run (new [] { "help", "echo" }));
|
||||
|
@ -56,7 +56,7 @@ namespace MonoTests.Mono.Options
|
||||
c, v => { string ignore = v.OptionValues [0]; });
|
||||
c.Option = p [0];
|
||||
Utils.AssertException (typeof(ArgumentOutOfRangeException),
|
||||
"Specified argument was out of the range of valid values.\nParameter name: index",
|
||||
$"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: index",
|
||||
c, v => { string ignore = v.OptionValues [2]; });
|
||||
c.OptionName = "-a";
|
||||
Utils.AssertException (typeof(OptionException),
|
||||
|
@ -374,10 +374,10 @@ namespace MonoTests.Mono.Options
|
||||
p, v => { v.Parse (_("-a", "-b")); });
|
||||
Assert.AreEqual (a, "-b");
|
||||
Utils.AssertException (typeof(ArgumentNullException),
|
||||
"Value cannot be null.\nParameter name: option",
|
||||
$"Value cannot be null.{Environment.NewLine}Parameter name: option",
|
||||
p, v => { v.Add ((Option) null); });
|
||||
Utils.AssertException (typeof(ArgumentNullException),
|
||||
"Value cannot be null.\nParameter name: header",
|
||||
$"Value cannot be null.{Environment.NewLine}Parameter name: header",
|
||||
p, v => { v.Add ((string) null); });
|
||||
|
||||
// bad type
|
||||
@ -394,10 +394,10 @@ namespace MonoTests.Mono.Options
|
||||
p, v => { v.Parse (_("-cz", "extra")); });
|
||||
|
||||
Utils.AssertException (typeof(ArgumentNullException),
|
||||
"Value cannot be null.\nParameter name: action",
|
||||
$"Value cannot be null.{Environment.NewLine}Parameter name: action",
|
||||
p, v => { v.Add ("foo", (Action<string>) null); });
|
||||
Utils.AssertException (typeof(ArgumentException),
|
||||
"Cannot provide maxValueCount of 2 for OptionValueType.None.\nParameter name: maxValueCount",
|
||||
$"Cannot provide maxValueCount of 2 for OptionValueType.None.{Environment.NewLine}Parameter name: maxValueCount",
|
||||
p, v => { v.Add ("foo", (k, val) => {/* ignore */}); });
|
||||
}
|
||||
|
||||
@ -772,7 +772,7 @@ namespace MonoTests.Mono.Options
|
||||
Utils.AssertException (typeof(ArgumentException), "prototypes must be null!",
|
||||
p, v => { v.Add ("N|NUM=", (int n) => {}); });
|
||||
Utils.AssertException (typeof(ArgumentNullException),
|
||||
"Value cannot be null.\nParameter name: option",
|
||||
$"Value cannot be null.{Environment.NewLine}Parameter name: option",
|
||||
p, v => { v.GetOptionForName (null); });
|
||||
}
|
||||
|
||||
|
@ -66,60 +66,60 @@ namespace MonoTests.Mono.Options
|
||||
{
|
||||
object p = null;
|
||||
Utils.AssertException (typeof(ArgumentNullException),
|
||||
"Value cannot be null.\nParameter name: prototype",
|
||||
$"Value cannot be null.{Environment.NewLine}Parameter name: prototype",
|
||||
p, v => { new DefaultOption (null, null); });
|
||||
Utils.AssertException (typeof(ArgumentException),
|
||||
"Cannot be the empty string.\nParameter name: prototype",
|
||||
$"Cannot be the empty string.{Environment.NewLine}Parameter name: prototype",
|
||||
p, v => { new DefaultOption ("", null); });
|
||||
Utils.AssertException (typeof(ArgumentException),
|
||||
"Empty option names are not supported.\nParameter name: prototype",
|
||||
$"Empty option names are not supported.{Environment.NewLine}Parameter name: prototype",
|
||||
p, v => { new DefaultOption ("a|b||c=", null); });
|
||||
Utils.AssertException (typeof(ArgumentException),
|
||||
"Conflicting option types: '=' vs. ':'.\nParameter name: prototype",
|
||||
$"Conflicting option types: '=' vs. ':'.{Environment.NewLine}Parameter name: prototype",
|
||||
p, v => { new DefaultOption ("a=|b:", null); });
|
||||
Utils.AssertException (typeof(ArgumentException),
|
||||
"The default option handler '<>' cannot require values.\nParameter name: prototype",
|
||||
$"The default option handler '<>' cannot require values.{Environment.NewLine}Parameter name: prototype",
|
||||
p, v => { new DefaultOption ("<>=", null); });
|
||||
Utils.AssertException (typeof(ArgumentException),
|
||||
"The default option handler '<>' cannot require values.\nParameter name: prototype",
|
||||
$"The default option handler '<>' cannot require values.{Environment.NewLine}Parameter name: prototype",
|
||||
p, v => { new DefaultOption ("<>:", null); });
|
||||
Utils.AssertException (null, null,
|
||||
p, v => { new DefaultOption ("t|<>=", null, 1); });
|
||||
Utils.AssertException (typeof(ArgumentException),
|
||||
"The default option handler '<>' cannot require values.\nParameter name: prototype",
|
||||
$"The default option handler '<>' cannot require values.{Environment.NewLine}Parameter name: prototype",
|
||||
p, v => { new DefaultOption ("t|<>=", null, 2); });
|
||||
Utils.AssertException (null, null,
|
||||
p, v => { new DefaultOption ("a|b=", null, 2); });
|
||||
Utils.AssertException (typeof(ArgumentOutOfRangeException),
|
||||
"Specified argument was out of the range of valid values.\nParameter name: maxValueCount",
|
||||
$"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: maxValueCount",
|
||||
p, v => { new DefaultOption ("a", null, -1); });
|
||||
Utils.AssertException (typeof(ArgumentException),
|
||||
"Cannot provide maxValueCount of 0 for OptionValueType.Required or " +
|
||||
"OptionValueType.Optional.\nParameter name: maxValueCount",
|
||||
$"OptionValueType.Optional.{Environment.NewLine}Parameter name: maxValueCount",
|
||||
p, v => { new DefaultOption ("a=", null, 0); });
|
||||
Utils.AssertException (typeof(ArgumentException),
|
||||
"Ill-formed name/value separator found in \"a={\".\nParameter name: prototype",
|
||||
"Ill-formed name/value separator found in \"a={\"." + Environment.NewLine + "Parameter name: prototype",
|
||||
p, v => { new DefaultOption ("a={", null); });
|
||||
Utils.AssertException (typeof(ArgumentException),
|
||||
"Ill-formed name/value separator found in \"a=}\".\nParameter name: prototype",
|
||||
"Ill-formed name/value separator found in \"a=}\"." + Environment.NewLine + "Parameter name: prototype",
|
||||
p, v => { new DefaultOption ("a=}", null); });
|
||||
Utils.AssertException (typeof(ArgumentException),
|
||||
"Ill-formed name/value separator found in \"a={{}}\".\nParameter name: prototype",
|
||||
"Ill-formed name/value separator found in \"a={{}}\"." + Environment.NewLine + "Parameter name: prototype",
|
||||
p, v => { new DefaultOption ("a={{}}", null); });
|
||||
Utils.AssertException (typeof(ArgumentException),
|
||||
"Ill-formed name/value separator found in \"a={}}\".\nParameter name: prototype",
|
||||
"Ill-formed name/value separator found in \"a={}}\"." + Environment.NewLine + "Parameter name: prototype",
|
||||
p, v => { new DefaultOption ("a={}}", null); });
|
||||
Utils.AssertException (typeof(ArgumentException),
|
||||
"Ill-formed name/value separator found in \"a={}{\".\nParameter name: prototype",
|
||||
"Ill-formed name/value separator found in \"a={}{\"." + Environment.NewLine + "Parameter name: prototype",
|
||||
p, v => { new DefaultOption ("a={}{", null); });
|
||||
Utils.AssertException (typeof(ArgumentException),
|
||||
"Cannot provide key/value separators for Options taking 1 value(s).\nParameter name: prototype",
|
||||
$"Cannot provide key/value separators for Options taking 1 value(s).{Environment.NewLine}Parameter name: prototype",
|
||||
p, v => { new DefaultOption ("a==", null); });
|
||||
Utils.AssertException (typeof(ArgumentException),
|
||||
"Cannot provide key/value separators for Options taking 1 value(s).\nParameter name: prototype",
|
||||
$"Cannot provide key/value separators for Options taking 1 value(s).{Environment.NewLine}Parameter name: prototype",
|
||||
p, v => { new DefaultOption ("a={}", null); });
|
||||
Utils.AssertException (typeof(ArgumentException),
|
||||
"Cannot provide key/value separators for Options taking 1 value(s).\nParameter name: prototype",
|
||||
$"Cannot provide key/value separators for Options taking 1 value(s).{Environment.NewLine}Parameter name: prototype",
|
||||
p, v => { new DefaultOption ("a=+-*/", null); });
|
||||
Utils.AssertException (null, null,
|
||||
p, v => { new DefaultOption ("a", null, 0); });
|
||||
|
Reference in New Issue
Block a user