예제 #1
0
        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();
        }
예제 #2
0
        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;
        }
예제 #3
0
 public IMapperConfiguration Use(IArgumentMapper mapper)
 {
     _mapper = mapper;
     return(this);
 }
예제 #4
0
 public MapperConfiguration()
 {
     _mapper = new DefaultArgumentMapper();
 }