Browse Source

Switch to per-line arguments

pull/3205/head
Christoph Wille 12 months ago
parent
commit
84b78b399f
  1. 2
      ILSpy.AddIn.Shared/ILSpyInstance.cs
  2. 12
      ILSpy.Tests/CommandLineArgumentsTests.cs
  3. 2
      ILSpy/CommandLineArguments.cs

2
ILSpy.AddIn.Shared/ILSpyInstance.cs

@ -52,7 +52,7 @@ namespace ICSharpCode.ILSpy.AddIn @@ -52,7 +52,7 @@ namespace ICSharpCode.ILSpy.AddIn
if ((commandLineArguments != null) && commandLineArguments.Any())
{
string assemblyArguments = string.Join(" ", commandLineArguments);
string assemblyArguments = string.Join("\r\n", commandLineArguments);
string filepath = Path.GetTempFileName();
File.WriteAllText(filepath, assemblyArguments);

12
ILSpy.Tests/CommandLineArgumentsTests.cs

@ -100,14 +100,22 @@ namespace ICSharpCode.ILSpy.Tests @@ -100,14 +100,22 @@ namespace ICSharpCode.ILSpy.Tests
}
[Test]
public void PassAtFileArgumentsSpaceSeparated()
public void PassAtFileArguments()
{
string filepath = System.IO.Path.GetTempFileName();
System.IO.File.WriteAllText(filepath, "assembly1 assembly2 assembly3 --newinstance --noactivate");
System.IO.File.WriteAllText(filepath, "assembly1\r\nassembly2\r\nassembly3\r\n--newinstance\r\n--noactivate");
var cmdLineArgs = new CommandLineArguments(new string[] { $"@{filepath}" });
try
{
System.IO.File.Delete(filepath);
}
catch (Exception)
{
}
cmdLineArgs.SingleInstance.Should().BeFalse();
cmdLineArgs.NoActivate.Should().BeTrue();
cmdLineArgs.AssembliesToLoad.Should().HaveCount(3);

2
ILSpy/CommandLineArguments.cs

@ -40,7 +40,7 @@ namespace ICSharpCode.ILSpy @@ -40,7 +40,7 @@ namespace ICSharpCode.ILSpy
{
var app = new CommandLineApplication() {
// https://natemcmaster.github.io/CommandLineUtils/docs/response-file-parsing.html?tabs=using-attributes
ResponseFileHandling = ResponseFileHandling.ParseArgsAsSpaceSeparated,
ResponseFileHandling = ResponseFileHandling.ParseArgsAsLineSeparated,
// Note: options are case-sensitive (!), and, default behavior would be UnrecognizedArgumentHandling.Throw on Parse()
// UnrecognizedArgumentHandling = UnrecognizedArgumentHandling.CollectAndContinue

Loading…
Cancel
Save