[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/usausa/Smart-Net-CommandLine/main/Develop/Program.cs [Back]  [Original]

using Develop;

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

using Smart.CommandLine.Hosting;

// Command host
var builder = CommandHost.CreateBuilder(args);

Console.WriteLine($"Application: {builder.Environment.ApplicationName}");
Console.WriteLine($"Environment: {builder.Environment.EnvironmentName}");

// Logging
builder.Services.AddLogging(logging =>
{
    logging.AddSimpleConsole(options =>
    {
        options.SingleLine = true;
        options.TimestampFormat = "HH:mm:ss.fff ";
        options.IncludeScopes = true;
    });
});

// Services
builder.Services.AddSingleton();
builder.Services.AddScoped();

// Commands
builder.ConfigureCommands(commands =>
{
    commands.ConfigureRootCommand(root =>
    {
        root.WithDescription("Sample CLI tool");
    });

    commands.AddGlobalFilter(order: -100);
    commands.AddGlobalFilter(order: Int32.MaxValue);

    commands.AddCommand();
    commands.AddCommand();
    commands.AddCommand();
    commands.AddCommand();
    commands.AddCommand();
    commands.AddCommand(user =>
    {
        user.AddSubCommand();
        user.AddSubCommand();
        user.AddSubCommand(role =>
        {
            role.AddSubCommand();
            role.AddSubCommand();
        });
    });
});

var host = builder.Build();

var exitCode = await host.RunAsync();
Console.WriteLine($"ExitCode: {exitCode}");
return exitCode;

Web Proxy Viewer  |  New URL  |  Original Page