Files
cneicy 18459f1e4b
Publish UPM package / publish (push) Failing after 1s
chore: initialize standalone UPM package
2026-08-26 02:49:40 +08:00

49 lines
1.7 KiB
C#

#nullable enable
using System;
using Cysharp.Threading.Tasks;
using ShrinkApp;
namespace ShrinkCommand.Integration.App
{
[ShrinkAppModuleInstaller]
[Obsolete("ClassicHost compatibility only. ContextLoader projects should use ShrinkCommandAppComponent from a composition root.")]
public sealed class ShrinkCommandAppInstaller : IShrinkAppModuleInstaller
{
public string ModuleId => "shrink.command";
public int Order => -1500;
public System.Collections.Generic.IReadOnlyList<string> DependsOn => Array.Empty<string>();
public void RegisterServices(ShrinkAppContext context)
{
context.Services.Register(new ShrinkCommandAppService(ShrinkCommandRuntime.Default));
}
public UniTask InitializeAsync(ShrinkAppContext context)
{
return UniTask.CompletedTask;
}
}
public sealed class ShrinkCommandAppService
{
public ShrinkCommandAppService(ShrinkCommandService service)
{
Service = service ?? throw new ArgumentNullException(nameof(service));
}
public ShrinkCommandService Service { get; }
public UniTask<ShrinkCommandExecutionResult> ExecuteAsync(
IShrinkCommandSource source,
string rawInput,
System.Threading.CancellationToken cancellationToken = default)
=> Service.ExecuteAsync(source, rawInput, cancellationToken);
public string BuildHelp(IShrinkCommandSource? source, string? prefix = null)
=> Service.BuildHelp(source, prefix);
public System.Collections.Generic.IReadOnlyList<ShrinkCommandDescriptor> Commands => Service.Commands;
}
}