Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@file support with breaking changes to command line options #3205

Merged
merged 16 commits into from
May 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Document behavior of option case sensitivity
  • Loading branch information
christophwille committed May 4, 2024
commit d8c4c855f569bcf5d313a63e4c11d3b0004f0925
20 changes: 19 additions & 1 deletion ILSpy.Tests/CommandLineArgumentsTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using FluentAssertions;
using System;

using FluentAssertions;

using NUnit.Framework;

@@ -36,6 +38,22 @@ public void VerifyNavigateToOption()
cmdLineArgs.NavigateTo.Should().BeEquivalentTo(navigateTo);
}

[Test]
public void VerifyNavigateToOption_NoneTest_Matching_VSAddin()
{
var cmdLineArgs = new CommandLineArguments(new string[] { "--navigateto:none" });
cmdLineArgs.NavigateTo.Should().BeEquivalentTo("none");
}

[Test]
public void VerifyCaseSensitivityOfOptionsThrows()
{
Action act = () => new CommandLineArguments(new string[] { "--navigateTo:none" });

act.Should().Throw<McMaster.Extensions.CommandLineUtils.UnrecognizedCommandParsingException>()
.WithMessage("Unrecognized option '--navigateTo:none'");
}

[Test]
public void VerifySearchOption()
{
3 changes: 3 additions & 0 deletions ILSpy/CommandLineArguments.cs
Original file line number Diff line number Diff line change
@@ -39,6 +39,9 @@ public CommandLineArguments(IEnumerable<string> arguments)
var app = new CommandLineApplication() {
// https://natemcmaster.github.io/CommandLineUtils/docs/response-file-parsing.html?tabs=using-attributes
ResponseFileHandling = ResponseFileHandling.ParseArgsAsSpaceSeparated,

// Note: options are case-sensitive (!), and, default behavior would be UnrecognizedArgumentHandling.Throw on Parse()
// UnrecognizedArgumentHandling = UnrecognizedArgumentHandling.CollectAndContinue
};

var oForceNewInstance = app.Option("--newinstance",
Loading