21 lines
568 B
C#
21 lines
568 B
C#
|
|
// Copyright (c) The Geekeey Authors
|
||
|
|
// SPDX-License-Identifier: EUPL-1.2
|
||
|
|
|
||
|
|
using Spectre.Console.Cli;
|
||
|
|
|
||
|
|
internal sealed class ExitCommand : AsyncCommand<ExitCommand.Settings>
|
||
|
|
{
|
||
|
|
public sealed class Settings : CommandSettings
|
||
|
|
{
|
||
|
|
[CommandArgument(1, "<code>")] public int Code { get; init; }
|
||
|
|
}
|
||
|
|
|
||
|
|
public override async Task<int> ExecuteAsync(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||
|
|
{
|
||
|
|
using var output = Output.Connect();
|
||
|
|
|
||
|
|
await output.Stderr.WriteLineAsync($"Exit code set to {settings.Code}");
|
||
|
|
|
||
|
|
return settings.Code;
|
||
|
|
}
|
||
|
|
}
|