Migrate to CliFx v3 (#1516)

This commit is contained in:
Oleksii Holub
2026-03-26 23:53:28 +02:00
committed by GitHub
parent 661f82c478
commit cc703cc860
17 changed files with 72 additions and 111 deletions

View File

@@ -21,12 +21,6 @@
<PublishMacOSBundle>false</PublishMacOSBundle>
</PropertyGroup>
<!-- HACK: Disable trim warnings because they seem to break when the code contains C# 14 extension blocks -->
<PropertyGroup>
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
<EnableAotAnalyzer>false</EnableAotAnalyzer>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="..\favicon.ico" Link="favicon.ico" />
</ItemGroup>

View File

@@ -2,16 +2,16 @@
#:package CliFx
using CliFx;
using CliFx.Attributes;
using CliFx.Binding;
using CliFx.Infrastructure;
return await new CliApplicationBuilder()
.AddCommand<PublishMacOSBundleCommand>()
return await new CommandLineApplicationBuilder()
.AddCommandsFromThisAssembly()
.Build()
.RunAsync(args);
[Command(Description = "Publishes the GUI app as a macOS .app bundle.")]
public class PublishMacOSBundleCommand : ICommand
public partial class PublishMacOSBundleCommand : ICommand
{
private const string BundleName = "DiscordChatExporter.app";
private const string AppName = "DiscordChatExporter";
@@ -21,16 +21,16 @@ public class PublishMacOSBundleCommand : ICommand
private const string AppIconName = "AppIcon";
[CommandOption("publish-dir", Description = "Path to the publish output directory.")]
public required string PublishDirPath { get; init; }
public required string PublishDirPath { get; set; }
[CommandOption("icons-file", Description = "Path to the .icns icons file.")]
public required string IconsFilePath { get; init; }
public required string IconsFilePath { get; set; }
[CommandOption("full-version", Description = "Full version string (e.g. '1.2.3.4').")]
public required string FullVersion { get; init; }
public required string FullVersion { get; set; }
[CommandOption("short-version", Description = "Short version string (e.g. '1.2.3').")]
public required string ShortVersion { get; init; }
public required string ShortVersion { get; set; }
public async ValueTask ExecuteAsync(IConsole console)
{