Beispiel #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();
        }
Beispiel #2
0
        public override async Task Execute()
        {
            Console2.White("Seeding Users... ");

            _db.Users.AddIfNotExists(m => m.Name == "Admin", new User
            {
                Name           = "Admin",
                Email          = "*****@*****.**",
                HashedPassword = Hash.Create("admin"),
                IsAdmin        = true,
                ConfirmedAt    = DateTime.Now
            });

            Console2.GreenLine("✅");

            Console2.White($"Seeding Providers... ");

            _db.Providers.AddIfNotExists(m => m.Name == "Four", new Provider
            {
                Name    = "Four",
                Amounts = "10,20,30,50"
            });

            _db.Providers.AddIfNotExists(m => m.Name == "Lemon", new Provider
            {
                Name    = "Lemon",
                Amounts = "15,25,50"
            });

            _db.Providers.AddIfNotExists(m => m.Name == "G-Mobile", new Provider
            {
                Name    = "G-Mobile",
                Amounts = "10,15,20,30"
            });

            Console2.GreenLine("✅");

            await _db.SaveChangesAsync();
        }
            public Task Execute()
            {
                var services = _services.Where(x =>
                                               !x.ServiceType.Namespace.StartsWith("Microsoft") &&
                                               !x.ServiceType.Namespace.StartsWith("System"));

                // if (input.Namespace.NotEmpty())
                services = services.Where(x =>
                                          x.ServiceType.Namespace.StartsWith("Mediat") ||
                                          x.ServiceType.Namespace.StartsWith("Miru") ||
                                          x.ServiceType.Namespace.StartsWith("Intanext"))
                           .OrderBy(x => x.ServiceType.FullName);

                foreach (var service in services)
                {
                    Console2.WhiteLine(service.ServiceType.FullName);
                    Console2.White("\t");
                    Console2.WhiteLine(service.Lifetime.ToString());
                    Console2.White("\t");
                    Console2.WhiteLine(service.ImplementationType?.FullName ?? "None");
                }

                return(Task.CompletedTask);
            }