Skip to content

Commit

Permalink
move verbose setting parsing to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
adamralph committed Nov 5, 2018
1 parent 985c546 commit aef73b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions MinVer.Cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static void Main(string[] args)
var majorMinor = app.Option("-m|--major-minor <MAJOR.MINOR>", "The MAJOR.MINOR version range. E.g. '2.0'.", CommandOptionType.SingleValue);
var path = app.Option("-p|--path <PATH>", "The path of the repository.", CommandOptionType.SingleValue);
var tagPrefix = app.Option("-t|--tag-prefix <TAG_PREFIX>", "The tag prefix.", CommandOptionType.SingleValue);
var verbose = app.Option("-v|--verbose", "Enable verbose logging.", CommandOptionType.NoValue);
var verbose = app.Option<bool>("-v|--verbose <VERBOSE>", "Verbose logging.", CommandOptionType.SingleValue);

app.OnExecute(() =>
{
Expand Down Expand Up @@ -44,7 +44,7 @@ static void Main(string[] args)
}
}
Console.Out.WriteLine(Versioner.GetVersion(path.Value() ?? ".", verbose.HasValue(), tagPrefix.Value(), major, minor, buildMetadata.Value()));
Console.Out.WriteLine(Versioner.GetVersion(path.Value() ?? ".", verbose.ParsedValue, tagPrefix.Value(), major, minor, buildMetadata.Value()));
});

app.Execute(args);
Expand Down
6 changes: 1 addition & 5 deletions MinVer/build/MinVer.targets
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
</PropertyGroup>

<Target Name="MinVer_GetVersion" Condition=" '$(MinVerVersion)' == '' ">
<Error Condition="'$(MinVerVerbose)' != '' And '$(MinVerVerbose)' != 'true' And '$(MinVerVerbose)' != 'false'" Code="MINVER0003" Text="MinVerVerbose/MINVER_VERBOSE value '$(MinVerVerbose)' cannot be converted to a Boolean value." />
<PropertyGroup>
<MinVerVerboseOption Condition="'$(MinVerVerbose)' == 'true'"> --verbose</MinVerVerboseOption>
</PropertyGroup>
<Exec Command="dotnet &quot;$(MSBuildThisFileDirectory)../MinVer/MinVer.Cli.dll&quot; --build-metadata &quot;$(MINVER_BUILD_METADATA)&quot; --path &quot;$(MSBuildProjectDirectory)&quot; --major-minor &quot;$(MinVerMajorMinor)&quot; --tag-prefix &quot;$(MinVerTagPrefix)&quot;$(MinVerVerboseOption)" ConsoleToMSBuild="true">
<Exec Command="dotnet &quot;$(MSBuildThisFileDirectory)../MinVer/MinVer.Cli.dll&quot; --build-metadata &quot;$(MINVER_BUILD_METADATA)&quot; --path &quot;$(MSBuildProjectDirectory)&quot; --major-minor &quot;$(MinVerMajorMinor)&quot; --tag-prefix &quot;$(MinVerTagPrefix)&quot; --verbose &quot;$(MinVerVerbose)&quot;" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" ItemName="MinVerConsoleOutputItems" />
</Exec>
<ItemGroup>
Expand Down

0 comments on commit aef73b2

Please sign in to comment.