Exemple #1
0
        private void ListAllCommands(HelpInput input)
        {
            if (!input.CommandTypes.Any())
            {
                Console.WriteLine("There are no known commands!");
                return;
            }

            var commands = input.CommandTypes.Select(type => new
            {
                Name        = CommandFactory.CommandNameFor(type),
                Description = CommandFactory.DescriptionFor(type)
            });

            var longestCommandName = commands
                                     .Select(m => m.Name)
                                     .Aggregate(string.Empty, (seed, f) => f?.Length > seed.Length ? f : seed);

            var padRight = longestCommandName.Length + 2;

            Console2.BreakLine();

            commands.OrderBy(m => m.Name).ForEach(m =>
            {
                Console2.Yellow(m.Name.PadRight(padRight));
                Console2.Write(m.Description);
                Console2.BreakLine();
            });

            Console2.BreakLine();
            Console2.Write("For a command usage, type: ");
            Console2.White("miru help <command>");
            Console2.BreakLine();
            Console2.BreakLine();
        }
Exemple #2
0
        public override bool Execute(Input input)
        {
            Console2.Yellow("App version: ");
            Console2.Line($"{Assembly.GetEntryAssembly().GetName().Name} {Assembly.GetEntryAssembly().GetName().Version}");

            Console2.Yellow("Miru version: ");
            Console2.Line(typeof(App).Assembly.GetName().Version?.ToString());
            Console.WriteLine();

            Console2.YellowLine("Host:");
            Console2.Line(_hostEnvironment.ToYml());

            Console2.YellowLine("All Configurations: ");
            Console.WriteLine(GetDebugView(_configuration as IConfigurationRoot));

            return(true);
        }