17 lines
821 B
C#
17 lines
821 B
C#
using System.CommandLine.Binding;
|
|
|
|
namespace DevDisciples.Json.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;
|
|
}
|
|
} |