public CommandRegistrationBuilder Add <TCommand>(Action <CommandRegistration> customize = default) where TCommand : IConsoleCommand { try { var registration = new CommandRegistration(_parameterConverter, typeof(TCommand), CommandHelper.GetCommandId(typeof(TCommand))); customize?.Invoke(registration); _commands.Add(registration); return(this); } catch (Exception inner) { throw DynamicException.Create ( $"RegisterCommand", $"An error occured while trying to register '{typeof(TCommand).ToPrettyString()}'. See the inner-exception for details.", inner ); } }
public static ICommandRegistrationContainer Register <T>(this ICommandRegistrationContainer commands) { return(commands.Register(CommandRegistration.Create <T>())); }