Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions src/MinimalCli.Core/MinimalCommandLineBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,52 +71,17 @@ public MinimalCommandLineApp Build()
{
this.RootCommand = new();
}
// NOTES: going to have to create a factory to get the correct instance of the CommandOptions
// for the command that was invoked, inside the Handler(serivces) function, can call
// var factory = services.GetRequiredService<CommandOptionsFactory>();
// var options = factory.GetOptionsFor<TCommandType>();
// then we can execute the function how it was meant to be ran

foreach (CommandOptions commandOptions in commandOptionsCollection)
{
// first call this function to setup all the parameter bindings
ParameterBinding[] bindings = commandOptions.SetupCommandParameterBindings();

//foreach (ParameterBinding p in bindings)
//{
// if(p is ArgumentBinding arg)
// Console.WriteLine(" Argument: {0} ({1})", arg.Argument.Name, arg.ParameterType);
// else if(p is OptionBinding opt)
// Console.WriteLine(" Option: {0} {1}", opt.Option.Name, opt.ParameterName);
//}
// TODO: do a verification of commands to make sure they aren't in a bad configuration

// Add command, at this point the action should already be set?
this.RootCommand.Subcommands.Add(commandOptions.Command);

// add options to a dictionary by the command name
cmdBindingFactory.AddCommandOptions(commandOptions.Command.Name, commandOptions);



//Console.WriteLine("Command: {0}", commandOptions.Command.Name);
//foreach (var arg in commandOptions.Command.Arguments)
// Console.WriteLine(" *Argument: {0} ({1})", arg.Name, arg.ValueType.FullName);
//foreach (var opt in commandOptions.Command.Options)
// Console.WriteLine(" *Option: {0} ({1})", opt.Name, opt.ValueType.FullName);

//List<ParameterBinding> bindings = commandOptions.GetCommandParameterBindings();
//foreach(ParameterBinding binding in bindings)
//{
// if (binding is ArgumentBinding arg)
// commandOptions.Command.Add(arg.Argument);
// else if (binding is OptionBinding opt)
// commandOptions.Command.Add(opt.Option);
// else if(binding is DependencyInjectionBinding dep)
// {
// // ...?
// }
//}
}

if (this.RootCommand is null)
Expand Down