Ejemplo n.º 1
0
        public void Initialize()
        {
            var currentType = GetType();

            var scanner = new CommandScanner();
            var systemCommandTypes = scanner.Scan(currentType.Assembly, currentType.Namespace);

            Register(systemCommandTypes);
        }
Ejemplo n.º 2
0
        public void Initialize()
        {
            var currentType = GetType();

            var scanner            = new CommandScanner();
            var systemCommandTypes = scanner.Scan(currentType.Assembly, currentType.Namespace);

            Register(systemCommandTypes);
        }
Ejemplo n.º 3
0
        public void returns_expected_when_no_commands_are_found_in_assembly()
        {
            var emptyAssembly = new AssemblyBuilder().Build();
            var sut = new CommandScanner();

            var result = sut.Scan(emptyAssembly);

            Assert.Empty(result);
        }
Ejemplo n.º 4
0
        public void returns_expected_when_no_commands_are_found_in_assembly()
        {
            var emptyAssembly = new AssemblyBuilder().Build();
            var sut           = new CommandScanner();

            var result = sut.Scan(emptyAssembly);

            Assert.Empty(result);
        }
Ejemplo n.º 5
0
        private void Initialize()
        {
            // TODO - allow help options to be configured via settings
            _configuration.AddNamedParameter("Help", true).AddShortName("h").AddShortName("?");

            // Scan all the commands for their options...
            CommandScanner scanner = new CommandScanner(_configuration);

            foreach (var c in _commands)
            {
                // Add the command to the configuration based on attribute decorations...
                var parserCommand = scanner.Scan(c);

                // Add the command to the map so we can find it after parsing...
                _commandMap.Add(parserCommand.Text, c);

                // Set help as the default command
                if (c == _helpCommand)
                {
                    _configuration.DefaultCommand = parserCommand;
                }
            }
        }