fixed issue with bool parameters

This commit is contained in:
irongut
2021-10-19 00:03:22 +01:00
parent 6ed1f6c50d
commit 7c070aea38
2 changed files with 10 additions and 5 deletions
@@ -1,4 +1,5 @@
using CommandLine; using CommandLine;
using System;
namespace CodeCoverageSummary namespace CodeCoverageSummary
{ {
@@ -7,14 +8,18 @@ namespace CodeCoverageSummary
[Value(index: 0, Required = true, HelpText = "Code coverage file to analyse.")] [Value(index: 0, Required = true, HelpText = "Code coverage file to analyse.")]
public string Filename { get; set; } public string Filename { get; set; }
[Option(longName: "badge", Required = false, HelpText = "Include a badge reporting the Line Rate coverage in the output using shields.io - true or false.", Default = false)] [Option(longName: "badge", Required = false, HelpText = "Include a badge reporting the Line Rate coverage in the output using shields.io - true or false.", Default = "false")]
public bool Badge { get; set; } public string BadgeString { get; set; }
public bool Badge => BadgeString.Equals("true", StringComparison.OrdinalIgnoreCase);
[Option(longName: "format", Required = false, HelpText = "Output Format - markdown or text.", Default = "text")] [Option(longName: "format", Required = false, HelpText = "Output Format - markdown or text.", Default = "text")]
public string Format { get; set; } public string Format { get; set; }
[Option(longName: "indicators", Required = false, HelpText = "Include package health indicators in the output - true or false.", Default = true)] [Option(longName: "indicators", Required = false, HelpText = "Include package health indicators in the output - true or false.", Default = "true")]
public bool Indicators { get; set; } public string IndicatorsString { get; set; }
public bool Indicators => IndicatorsString.Equals("true", StringComparison.OrdinalIgnoreCase);
[Option(longName: "output", Required = false, HelpText = "Output Type - console, file or both.", Default = "console")] [Option(longName: "output", Required = false, HelpText = "Output Type - console, file or both.", Default = "console")]
public string Output { get; set; } public string Output { get; set; }
@@ -2,7 +2,7 @@
"profiles": { "profiles": {
"CodeCoverageSummary": { "CodeCoverageSummary": {
"commandName": "Project", "commandName": "Project",
"commandLineArgs": "../../../../coverage.cobertura.xml --format=md --badge=true --thresholds=\"80 90\"" "commandLineArgs": "../../../../coverage.cobertura.xml --format=md --badge true --thresholds=\"80 90\""
}, },
"Docker": { "Docker": {
"commandName": "Docker", "commandName": "Docker",