-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
@file support with breaking changes to command line options
#3205
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
a433203
Add tests for existing command line parsing
christophwille e394032
Switch CommandLineArguments to McMaster
christophwille 1d76d0a
Fix namespace import
christophwille 4b52925
Add more help text, type some options
christophwille d0c443c
Switch to --newinstance
christophwille 6025104
Adapt ILSpyInstance:Start to new command line options
christophwille d8c4c85
Document behavior of option case sensitivity
christophwille 896bf76
Fix --navigateto for code items
christophwille 4f217e8
launchSettings.json had a /separate param included (newinstance now)
christophwille 1fc9f92
Enable help option (going with https://blog.rsuter.com/write-applicat…
christophwille 6762dd6
Show help - via a dialog box and not a flickering command line
christophwille d222178
Keep track of temp files and try to clean in QueryClose (if VS does n…
christophwille 049b867
Special-case @file in FullyQualityPath to avoid situations like Syste…
christophwille 84b78b3
Switch to per-line arguments
christophwille 8ad24cd
Set UnrecognizedArgumentHandling to CollectAndContinue
christophwille e4e2dd3
Fix docs for space for line syntax in response file
christophwille File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| using System; | ||
|
|
||
| using FluentAssertions; | ||
|
|
||
| using NUnit.Framework; | ||
|
|
||
| namespace ICSharpCode.ILSpy.Tests | ||
| { | ||
| [TestFixture] | ||
| public class CommandLineArgumentsTests | ||
| { | ||
| [Test] | ||
| public void VerifyEmptyArgumentsArray() | ||
| { | ||
| var cmdLineArgs = new CommandLineArguments(new string[] { }); | ||
|
|
||
| cmdLineArgs.AssembliesToLoad.Should().BeEmpty(); | ||
| cmdLineArgs.SingleInstance.Should().BeNull(); | ||
| cmdLineArgs.NavigateTo.Should().BeNull(); | ||
| cmdLineArgs.Search.Should().BeNull(); | ||
| cmdLineArgs.Language.Should().BeNull(); | ||
| cmdLineArgs.NoActivate.Should().BeFalse(); | ||
| cmdLineArgs.ConfigFile.Should().BeNull(); | ||
| } | ||
|
|
||
| [Test] | ||
| public void VerifyForceNewInstanceOption() | ||
| { | ||
| var cmdLineArgs = new CommandLineArguments(new string[] { "--newinstance" }); | ||
| cmdLineArgs.SingleInstance.Should().BeFalse(); | ||
| } | ||
|
|
||
| [Test] | ||
| public void VerifyNavigateToOption() | ||
| { | ||
| const string navigateTo = "MyNamespace.MyClass"; | ||
| var cmdLineArgs = new CommandLineArguments(new string[] { "--navigateto", navigateTo }); | ||
| 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() | ||
| { | ||
| const string searchWord = "TestContainers"; | ||
| var cmdLineArgs = new CommandLineArguments(new string[] { "--search", searchWord }); | ||
| cmdLineArgs.Search.Should().BeEquivalentTo(searchWord); | ||
| } | ||
|
|
||
| [Test] | ||
| public void VerifyLanguageOption() | ||
| { | ||
| const string language = "csharp"; | ||
| var cmdLineArgs = new CommandLineArguments(new string[] { "--language", language }); | ||
| cmdLineArgs.Language.Should().BeEquivalentTo(language); | ||
| } | ||
|
|
||
| [Test] | ||
| public void VerifyConfigOption() | ||
| { | ||
| const string configFile = "myilspyoptions.xml"; | ||
| var cmdLineArgs = new CommandLineArguments(new string[] { "--config", configFile }); | ||
| cmdLineArgs.ConfigFile.Should().BeEquivalentTo(configFile); | ||
| } | ||
|
|
||
| [Test] | ||
| public void VerifyNoActivateOption() | ||
| { | ||
| var cmdLineArgs = new CommandLineArguments(new string[] { "--noactivate" }); | ||
| cmdLineArgs.NoActivate.Should().BeTrue(); | ||
| } | ||
|
|
||
| [Test] | ||
| public void MultipleAssembliesAsArguments() | ||
| { | ||
| var cmdLineArgs = new CommandLineArguments(new string[] { "assembly1", "assembly2", "assembly3" }); | ||
| cmdLineArgs.AssembliesToLoad.Should().HaveCount(3); | ||
| } | ||
|
|
||
| [Test] | ||
| public void PassAtFileArgumentsSpaceSeparated() | ||
| { | ||
| string filepath = System.IO.Path.GetTempFileName(); | ||
|
|
||
| System.IO.File.WriteAllText(filepath, "assembly1 assembly2 assembly3 --newinstance --noactivate"); | ||
|
|
||
| var cmdLineArgs = new CommandLineArguments(new string[] { $"@{filepath}" }); | ||
|
|
||
| cmdLineArgs.SingleInstance.Should().BeFalse(); | ||
| cmdLineArgs.NoActivate.Should().BeTrue(); | ||
| cmdLineArgs.AssembliesToLoad.Should().HaveCount(3); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.