Skip to content
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

Improve style disable when NO_COLOR #30

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions src/Sample/Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
</ItemGroup>
<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
</ItemGroup>

<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>

</Project>
5 changes: 2 additions & 3 deletions src/dotnet-retest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
config.SetApplicationName("dotnet retest");
config.SetApplicationVersion(ThisAssembly.Project.Version);

if (Environment.GetEnvironmentVariables().Contains("NO_COLOR") &&
config.Settings.HelpProviderStyles?.Options is { } options)
options.DefaultValue = Style.Plain;
if (Environment.GetEnvironmentVariables().Contains("NO_COLOR"))
config.Settings.HelpProviderStyles = null;
});

if (args.Contains("--version"))
Expand Down
97 changes: 49 additions & 48 deletions src/dotnet-retest/dotnet-retest.csproj
Original file line number Diff line number Diff line change
@@ -1,48 +1,49 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Devlooped</RootNamespace>
<AssemblyName>retest</AssemblyName>
<NoWarn>CS9107</NoWarn>
<GenerateDocumentationFile>false</GenerateDocumentationFile>

<PackageId>dotnet-retest</PackageId>
<ToolCommandName>dotnet-retest</ToolCommandName>
<PackAsTool>true</PackAsTool>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<PackageTags>dotnet dotnet-tool</PackageTags>

<BuildDate>$([System.DateTime]::Now.ToString("yyyy-MM-dd"))</BuildDate>
<BuildRef>$(GITHUB_REF_NAME)</BuildRef>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CliWrap" Version="3.6.6" />
<PackageReference Include="Devlooped.Web" Version="1.2.2" />
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
<PackageReference Include="NuGetizer" Version="1.2.3" />
<PackageReference Include="NuGet.Protocol" Version="6.11.0" />
<PackageReference Include="Spectre.Console.Cli" Version="0.49.1" />
<PackageReference Include="ThisAssembly.Git" Version="1.5.0" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.Project" Version="1.5.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<ProjectProperty Include="ToolCommandName" />
<ProjectProperty Include="BuildDate" />
<ProjectProperty Include="BuildRef" />
<ProjectProperty Include="PackageId" />
<ProjectProperty Include="PackageVersion" />
<ProjectProperty Include="PackageProjectUrl" />
</ItemGroup>

<Target Name="RenderHelp" AfterTargets="Build">
<WriteLinesToFile Lines="```shell" Overwrite="true" File="help.md" />
<Exec Command="dotnet run --no-build -- --help &gt;&gt; help.md" EnvironmentVariables="NO_COLOR=true" ContinueOnError="true" />
<WriteLinesToFile Lines="```" Overwrite="false" File="help.md" />
</Target>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Devlooped</RootNamespace>
<AssemblyName>retest</AssemblyName>
<NoWarn>CS9107</NoWarn>
<GenerateDocumentationFile>false</GenerateDocumentationFile>

<PackageId>dotnet-retest</PackageId>
<ToolCommandName>dotnet-retest</ToolCommandName>
<PackAsTool>true</PackAsTool>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<PackageTags>dotnet dotnet-tool</PackageTags>

<BuildDate>$([System.DateTime]::Now.ToString("yyyy-MM-dd"))</BuildDate>
<BuildRef>$(GITHUB_REF_NAME)</BuildRef>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CliWrap" Version="3.6.6" />
<PackageReference Include="Devlooped.Web" Version="1.2.2" />
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
<PackageReference Include="NuGetizer" Version="1.2.3" />
<PackageReference Include="NuGet.Protocol" Version="6.11.0" />
<PackageReference Include="Spectre.Console.Cli" Version="0.49.1" />
<PackageReference Include="ThisAssembly.Git" Version="1.5.0" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.Project" Version="1.5.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<ProjectProperty Include="ToolCommandName" />
<ProjectProperty Include="BuildDate" />
<ProjectProperty Include="BuildRef" />
<ProjectProperty Include="PackageId" />
<ProjectProperty Include="PackageVersion" />
<ProjectProperty Include="PackageProjectUrl" />
</ItemGroup>

<Target Name="RenderHelp" AfterTargets="Build" Condition="$(DesignTimeBuild) != 'true'">
<WriteLinesToFile Lines="```shell" Overwrite="true" File="help.md" />
<Exec Command="dotnet run --no-build -- --help &gt;&gt; help.md"
EnvironmentVariables="NO_COLOR=true" />
<WriteLinesToFile Lines="```" Overwrite="false" File="help.md" />
</Target>

</Project>