You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update to System.CommandLine 2.0 and refactor usage (#1776) (#1777)
* Update to System.CommandLine 2.0 and refactor usage (#1776)
Updated the System.CommandLine package to the stable version 2.0.0.
Replaced deprecated `CommandLineParser.Parse` and `CommandLineConfiguration.InvokeAsync`
with `RootCommand.Parse` and `ParseResult.InvokeAsync` respectively.
* Update Changelog.md
- add improvements
- add new fixe 1776, 1764, 1741
Copy file name to clipboardExpand all lines: src/coverlet.console/Program.cs
+34-42Lines changed: 34 additions & 42 deletions
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,6 @@
4
4
usingSystem;
5
5
usingSystem.Collections.Generic;
6
6
usingSystem.CommandLine;
7
-
usingSystem.CommandLine.Help;
8
-
usingSystem.CommandLine.Parsing;
9
7
usingSystem.ComponentModel;
10
8
usingSystem.Diagnostics;
11
9
usingSystem.Globalization;
@@ -31,11 +29,11 @@ public static class Program
31
29
staticasyncTask<int>Main(string[]args)
32
30
{
33
31
Argument<string>moduleOrAppDirectory=new("path"){Description="Path to the test assembly or application directory."};
34
-
Option<string>target=new("--target",aliases:new[]{"--target","-t"}){Description="Path to the test runner application.",Arity=ArgumentArity.ZeroOrOne,Required=true};
35
-
Option<string>targs=new("--targetargs",aliases:new[]{"--targetargs","-a"}){Description="Arguments to be passed to the test runner.",Arity=ArgumentArity.ZeroOrOne};
36
-
Option<string>output=new("--output",aliases:new[]{"--output","-o"}){Description="Output of the generated coverage report",Arity=ArgumentArity.ZeroOrOne};
37
-
Option<LogLevel>verbosity=new("--verbosity",aliases:new[]{"--verbosity","-v"}){DefaultValueFactory=(_)=>LogLevel.Normal,Description="Sets the verbosity level of the command. Allowed values are quiet, minimal, normal, detailed.",Arity=ArgumentArity.ZeroOrOne};
38
-
Option<string[]>formats=new("--format",aliases:new[]{"--format","-f"}){DefaultValueFactory=(_)=>new[]{"json"},Description="Format of the generated coverage report.",Arity=ArgumentArity.ZeroOrMore,AllowMultipleArgumentsPerToken=true};
32
+
Option<string>target=new("--target","-t"){Description="Path to the test runner application.",Arity=ArgumentArity.ZeroOrOne,Required=true};
33
+
Option<string>targs=new("--targetargs","-a"){Description="Arguments to be passed to the test runner.",Arity=ArgumentArity.ZeroOrOne};
34
+
Option<string>output=new("--output","-o"){Description="Output of the generated coverage report",Arity=ArgumentArity.ZeroOrOne};
35
+
Option<LogLevel>verbosity=new("--verbosity","-v"){DefaultValueFactory=(_)=>LogLevel.Normal,Description="Sets the verbosity level of the command. Allowed values are quiet, minimal, normal, detailed.",Arity=ArgumentArity.ZeroOrOne};
36
+
Option<string[]>formats=new("--format","-f"){DefaultValueFactory=(_)=>new[]{"json"},Description="Format of the generated coverage report.",Arity=ArgumentArity.ZeroOrMore,AllowMultipleArgumentsPerToken=true};
Option<string>threshold=new("--threshold"){Description="Exits with error if the coverage % is below value.",Arity=ArgumentArity.ZeroOrOne};
41
39
Option<List<string>>thresholdTypes=new("--threshold-type"){DefaultValueFactory=(_)=>["line","branch","method"],Description="Coverage type to apply the threshold to."};
Option<string>sourceMappingFile=new("--source-mapping-file"){Description="Specifies the path to a SourceRootsMappings file.",Arity=ArgumentArity.ZeroOrOne};
0 commit comments