Skip to content

更新命令行库和约定默认编码 #172

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion DebUOS/Packaging.DebUOS.Tool/Options.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using dotnetCampus.Cli;
using DotNetCampus.Cli.Compiler;

namespace Packaging.DebUOS.Tool;

Expand All @@ -22,4 +22,10 @@ public class Options

[Option('o', "Output", Description = "Output path", LocalizableDescription = "输出的 deb 文件路径")]
public string? OutputPath { set; get; }

/// <summary>
/// 是否强行使用 UTF-8 编码作为控制台输出
/// </summary>
[Option()]
public bool? ForceUtf8ConsoleOutput { get; init; }
}
3 changes: 3 additions & 0 deletions DebUOS/Packaging.DebUOS.Tool/Packaging.DebUOS.Tool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@
<PrivateAssets>all</PrivateAssets>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="dotnetCampus.CommandLine" Version="4.0.0-alpha04" />
</ItemGroup>
</Project>
8 changes: 7 additions & 1 deletion DebUOS/Packaging.DebUOS.Tool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

using System.Reflection;
using System.Text;
using dotnetCampus.Cli;
using DotNetCampus.Cli;
using DotNetCampus.Cli.Compiler;
using dotnetCampus.Configurations.Core;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
Expand All @@ -13,6 +14,11 @@

var options = CommandLine.Parse(args).As<Options>();

if (options.ForceUtf8ConsoleOutput is true)
{
Console.OutputEncoding = Encoding.UTF8;
}

var loggerFactory = LoggerFactory.Create(builder =>
{
builder.AddConsole(loggerOptions => loggerOptions.FormatterName = MSBuildFormatter.FormatterName);
Expand Down
1 change: 0 additions & 1 deletion DebUOS/Packaging.DebUOS/Packaging.DebUOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<ItemGroup>
<!-- BoncyCastle and SharpZipLib are included in the lib\ folder in the Packaging.Targets package (see below), so we don't need an
explicit dependency on them, either -->
<PackageReference Include="dotnetCampus.CommandLine" Version="3.3.1" />
<PackageReference Include="dotnetCampus.Configurations" Version="1.6.12" />

<PackageReference Include="dotnetCampus.MSBuildUtils.Source" Version="1.1.1-alpha01">
Expand Down
Loading