public CleeEngine(ICommandRegistry commandRegistry, ICommandFactory commandFactory, IArgumentMapper argumentMapper, ICommandExecutor commandExecutor) { _registry = commandRegistry; _commandFactory = commandFactory; _mapper = argumentMapper; _commandExecutor = commandExecutor; _systemRegistry = SystemCommandRegistry.CreateAndInitialize(); // this should be removed from the constructor! _systemCommandFactory = new SystemCommandFactory(); _systemCommandFactory.RegisterInstance<ICommandRegistry>(_registry); _systemCommandFactory.RegisterInstance<ICommandFactory>(_commandFactory); _systemCommandFactory.RegisterInstance<IArgumentMapper>(_mapper); _systemCommandFactory.RegisterInstance<ICommandExecutor>(_commandExecutor); _systemCommandFactory.RegisterInstance<SystemCommandRegistry>(_systemRegistry); _systemCommandFactory.RegisterFactoryMethod<IOutputWriter>(() => _outputWriter); _systemCommandFactory.RegisterInstance(_settings); _history = new LinkedList<HistoryEntry>(); _outputWriter = new DefaultOutputWriter(); }
public CleeEngine(ICommandRegistry commandRegistry, ICommandFactory commandFactory, IArgumentMapper argumentMapper, ICommandExecutor commandExecutor) { _registry = commandRegistry; _commandFactory = commandFactory; _mapper = argumentMapper; _commandExecutor = commandExecutor; _systemRegistry = SystemCommandRegistry.CreateAndInitialize(); // this should be removed from the constructor! _systemCommandFactory = new SystemCommandFactory(); _systemCommandFactory.RegisterInstance <ICommandRegistry>(_registry); _systemCommandFactory.RegisterInstance <ICommandFactory>(_commandFactory); _systemCommandFactory.RegisterInstance <IArgumentMapper>(_mapper); _systemCommandFactory.RegisterInstance <ICommandExecutor>(_commandExecutor); _systemCommandFactory.RegisterInstance <SystemCommandRegistry>(_systemRegistry); _systemCommandFactory.RegisterFactoryMethod <IOutputWriter>(() => _outputWriter); _systemCommandFactory.RegisterInstance(_settings); _history = new LinkedList <HistoryEntry>(); _outputWriter = new DefaultOutputWriter(); _exitCodeAssigner = exitCode => Environment.ExitCode = exitCode; }
public IMapperConfiguration Use(IArgumentMapper mapper) { _mapper = mapper; return(this); }
public MapperConfiguration() { _mapper = new DefaultArgumentMapper(); }