build: initial project release
This commit is contained in:
commit
0de3af3033
59 changed files with 4903 additions and 0 deletions
29
src/process.dummy.app/_commands/EnvironmentCommand.cs
Normal file
29
src/process.dummy.app/_commands/EnvironmentCommand.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright (c) The Geekeey Authors
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
using Spectre.Console.Cli;
|
||||
|
||||
internal sealed class EnvironmentCommand : AsyncOutputCommand<EnvironmentCommand.Settings>
|
||||
{
|
||||
public sealed class Settings : OutputCommandSettings
|
||||
{
|
||||
[CommandArgument(0, "<ARGUMENT>")] public string[] Variables { get; init; } = [];
|
||||
}
|
||||
|
||||
public override async Task<int> ExecuteAsync(CommandContext context, Settings settings, CancellationToken cancellationToken)
|
||||
{
|
||||
using var output = Output.Connect();
|
||||
|
||||
foreach (var name in settings.Variables)
|
||||
{
|
||||
var value = Environment.GetEnvironmentVariable(name) ?? string.Empty;
|
||||
|
||||
foreach (var writer in output.GetWriters(settings.Target))
|
||||
{
|
||||
await writer.WriteLineAsync(value);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue