jtr/Jtr.Tools.CLI/Extensions/CommandOptionsExtensions.cs
mdnapo 96c203f842
All checks were successful
Run the JSON parser tests / test (push) Has been skipped
Moved UI to separate project, added Dockerfile & renamed project
2024-10-19 12:04:40 +02:00

17 lines
807 B
C#

using System.CommandLine.Binding;
namespace Jtr.Tools.CLI.Extensions;
public static class CommandOptionsExtensions
{
public static T WithCommonBindings<T>(this T options, BindingContext context)
where T : CommandOptions
{
options.Input = context.ParseResult.GetValueForOption(SharedCommandOptions.InputOption);
options.InputFile = context.ParseResult.GetValueForOption(SharedCommandOptions.InputFileOption);
options.InputArgument = context.ParseResult.GetValueForArgument(SharedCommandOptions.InputArgument);
options.Output = context.ParseResult.GetValueForOption(SharedCommandOptions.OutputOption);
options.OutputFile = context.ParseResult.GetValueForOption(SharedCommandOptions.OutputFileOption);
return options;
}
}