diff --git a/Directory.Packages.props b/Directory.Packages.props index 8a463e0..8eba101 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,7 +6,7 @@ - + diff --git a/src/assembly-differ/ApiCommands.cs b/src/assembly-differ/ApiCommands.cs index 121919c..3a08795 100644 --- a/src/assembly-differ/ApiCommands.cs +++ b/src/assembly-differ/ApiCommands.cs @@ -26,9 +26,8 @@ public sealed class ReportOptions /// -o, --output, A directory or file to write the report to, besides the console. public string? Output { get; set; } - /// Exit with code 4 when the suggested version change is at least this: none (never), patch, minor or major. - [AllowedValues("none", "patch", "minor", "major")] - public string FailOn { get; set; } = "none"; + /// Exit with code 4 when the suggested version change is at least this; none never fails. + public SuggestedVersionChange FailOn { get; set; } = SuggestedVersionChange.None; } /// Compares the public API of two versions of a library and suggests the version change it calls for. @@ -260,7 +259,7 @@ private static int Run( { if (sides() is not var (oldSide, newSide)) return null; - var failOn = Enum.Parse(report.FailOn, ignoreCase: true); + var failOn = report.FailOn; return DiffRunner.Run( oldSide, newSide, diff --git a/src/assembly-differ/Projects/ProjectComparison.cs b/src/assembly-differ/Projects/ProjectComparison.cs index 9239472..8bc649d 100644 --- a/src/assembly-differ/Projects/ProjectComparison.cs +++ b/src/assembly-differ/Projects/ProjectComparison.cs @@ -107,7 +107,7 @@ public static int Run(string directory, Options options, ReportOptions report) } var targets = new HashSet(report.Target ?? projects.Select(p => p.AssemblyName), StringComparer.OrdinalIgnoreCase); - var failOn = Enum.Parse(report.FailOn, ignoreCase: true); + var failOn = report.FailOn; return DiffRunner.Run( new DiffSide(new CompositeAssemblyProvider(oldAssemblies.Select(s => s.Provider)), "projects"), new DiffSide(new CompositeAssemblyProvider(newAssemblies.Select(s => s.Provider)), "projects"), diff --git a/tests/assembly-differ.Tests/.snapshots/CommandsTests/Help.files.618511ab.verified.txt b/tests/assembly-differ.Tests/.snapshots/CommandsTests/Help.files.618511ab.verified.txt index 75864ce..48c0c7c 100644 --- a/tests/assembly-differ.Tests/.snapshots/CommandsTests/Help.files.618511ab.verified.txt +++ b/tests/assembly-differ.Tests/.snapshots/CommandsTests/Help.files.618511ab.verified.txt @@ -14,7 +14,8 @@ Options: -t, --target [repeatable] Only compare these assemblies, by file name without extension. Repeat it for more than one. -f, --format The report: markdown, xml, asciidoc, github-comment or json. [default: markdown] [allowed: markdown|xml|asciidoc|github-comment|json] -o, --output A directory or file to write the report to, besides the console. - --fail-on Exit with code 4 when the suggested version change is at least this: none (never), patch, minor or major. [default: none] [allowed: none|patch|minor|major] + --fail-on Exit with code 4 when the suggested version change is at least this; none never fails. [default: none] + One of: Examples: assembly-differ files bin/1.2.0/MyLib.dll bin/1.3.0/MyLib.dll diff --git a/tests/assembly-differ.Tests/.snapshots/CommandsTests/Help.nuget.84cf3223.verified.txt b/tests/assembly-differ.Tests/.snapshots/CommandsTests/Help.nuget.84cf3223.verified.txt index 9ff6a1c..7137a36 100644 --- a/tests/assembly-differ.Tests/.snapshots/CommandsTests/Help.nuget.84cf3223.verified.txt +++ b/tests/assembly-differ.Tests/.snapshots/CommandsTests/Help.nuget.84cf3223.verified.txt @@ -16,7 +16,8 @@ Options: -t, --target [repeatable] Only compare these assemblies, by file name without extension. Repeat it for more than one. -f, --format The report: markdown, xml, asciidoc, github-comment or json. [default: markdown] [allowed: markdown|xml|asciidoc|github-comment|json] -o, --output A directory or file to write the report to, besides the console. - --fail-on Exit with code 4 when the suggested version change is at least this: none (never), patch, minor or major. [default: none] [allowed: none|patch|minor|major] + --fail-on Exit with code 4 when the suggested version change is at least this; none never fails. [default: none] + One of: Notes: diff --git a/tests/assembly-differ.Tests/.snapshots/CommandsTests/Help.projects.4296bad0.verified.txt b/tests/assembly-differ.Tests/.snapshots/CommandsTests/Help.projects.4296bad0.verified.txt index 3382cd7..3818e7d 100644 --- a/tests/assembly-differ.Tests/.snapshots/CommandsTests/Help.projects.4296bad0.verified.txt +++ b/tests/assembly-differ.Tests/.snapshots/CommandsTests/Help.projects.4296bad0.verified.txt @@ -12,7 +12,8 @@ Options: -t, --target [repeatable] Only compare these assemblies, by file name without extension. Repeat it for more than one. -f, --format The report: markdown, xml, asciidoc, github-comment or json. [default: markdown] [allowed: markdown|xml|asciidoc|github-comment|json] -o, --output A directory or file to write the report to, besides the console. - --fail-on Exit with code 4 when the suggested version change is at least this: none (never), patch, minor or major. [default: none] [allowed: none|patch|minor|major] + --fail-on Exit with code 4 when the suggested version change is at least this; none never fails. [default: none] + One of: Notes: diff --git a/tests/assembly-differ.Tests/.snapshots/CommandsTests/Help.release.2196f031.verified.txt b/tests/assembly-differ.Tests/.snapshots/CommandsTests/Help.release.2196f031.verified.txt index 1143bce..b634c90 100644 --- a/tests/assembly-differ.Tests/.snapshots/CommandsTests/Help.release.2196f031.verified.txt +++ b/tests/assembly-differ.Tests/.snapshots/CommandsTests/Help.release.2196f031.verified.txt @@ -16,7 +16,8 @@ Options: -t, --target [repeatable] Only compare these assemblies, by file name without extension. Repeat it for more than one. -f, --format The report: markdown, xml, asciidoc, github-comment or json. [default: markdown] [allowed: markdown|xml|asciidoc|github-comment|json] -o, --output A directory or file to write the report to, besides the console. - --fail-on Exit with code 4 when the suggested version change is at least this: none (never), patch, minor or major. [default: none] [allowed: none|patch|minor|major] + --fail-on Exit with code 4 when the suggested version change is at least this; none never fails. [default: none] + One of: Notes: