Example #1
0
        private void printDefinitions(PrintType type)
        {
            var definitions =
                Bootstrapper.GetDefinitionBuilder()
                .Definitions
                .Where(x =>
                       x.Type == DefinitionCacheItemType.Script ||
                       x.Type == DefinitionCacheItemType.LanguageScript);

            if (type == PrintType.Simple)
            {
                Console.WriteLine("Available commands:");
                UsagePrinter.PrintDefinitionsAligned(definitions);
            }
            else if (type == PrintType.Names)
            {
                UsagePrinter.PrintDefinitionNames(definitions);
            }
            else
            {
                Console.WriteLine("Available commands:");
                foreach (var definition in definitions)
                {
                    UsagePrinter.PrintDefinition(definition);
                }
            }
        }
Example #2
0
        public void Execute(string[] arguments)
        {
            var definitions = Bootstrapper.GetDefinitionBuilder().Definitions;

            if (arguments.Length != 1)
            {
                UsagePrinter.PrintDefinitionsAligned(
                    definitions
                    .OrderBy(x => x.Name));
                return;
            }
            var commandName = arguments[0];
            var command     = definitions.FirstOrDefault(x => x.Name == commandName);

            if (command == null)
            {
                Console.WriteLine("{0} is not a valid command", commandName);
                return;
            }

            UsagePrinter.PrintDefinition(command);
            Console.WriteLine();
        }