Browse Source

Enable help option (going with https://blog.rsuter.com/write-application-can-act-console-application-wpf-gui-application/ to display help leads to a flickering console window)

pull/3205/head
Christoph Wille 1 year ago
parent
commit
1fc9f92917
  1. 7
      ILSpy.Tests/CommandLineArgumentsTests.cs
  2. 8
      ILSpy/CommandLineArguments.cs

7
ILSpy.Tests/CommandLineArgumentsTests.cs

@ -23,6 +23,13 @@ namespace ICSharpCode.ILSpy.Tests @@ -23,6 +23,13 @@ namespace ICSharpCode.ILSpy.Tests
cmdLineArgs.ConfigFile.Should().BeNull();
}
[Test]
public void VerifyHelpOption()
{
var cmdLineArgs = new CommandLineArguments(new string[] { "--help" });
cmdLineArgs.ArgumentsParser.IsShowingInformation.Should().BeTrue();
}
[Test]
public void VerifyForceNewInstanceOption()
{

8
ILSpy/CommandLineArguments.cs

@ -23,7 +23,7 @@ using System.Linq; @@ -23,7 +23,7 @@ using System.Linq;
namespace ICSharpCode.ILSpy
{
sealed class CommandLineArguments
public sealed class CommandLineArguments
{
// see /doc/Command Line.txt for details
public List<string> AssembliesToLoad = new List<string>();
@ -34,6 +34,8 @@ namespace ICSharpCode.ILSpy @@ -34,6 +34,8 @@ namespace ICSharpCode.ILSpy
public bool NoActivate;
public string ConfigFile;
public CommandLineApplication ArgumentsParser { get; }
public CommandLineArguments(IEnumerable<string> arguments)
{
var app = new CommandLineApplication() {
@ -44,6 +46,9 @@ namespace ICSharpCode.ILSpy @@ -44,6 +46,9 @@ namespace ICSharpCode.ILSpy
// UnrecognizedArgumentHandling = UnrecognizedArgumentHandling.CollectAndContinue
};
app.HelpOption();
ArgumentsParser = app;
var oForceNewInstance = app.Option("--newinstance",
"Start a new instance of ILSpy even if the user configuration is set to single-instance",
CommandOptionType.NoValue);
@ -76,7 +81,6 @@ namespace ICSharpCode.ILSpy @@ -76,7 +81,6 @@ namespace ICSharpCode.ILSpy
// To enable this, MultipleValues must be set to true, and the argument must be the last one specified.
var files = app.Argument("Assemblies", "Assemblies to load", multipleValues: true);
// string helptext = app.GetHelpText();
app.Parse(arguments.ToArray());
if (oForceNewInstance.HasValue())

Loading…
Cancel
Save