示例#1
0
 static async Task Main(string[] args)
 {
     await CoconaApp.RunAsync <Program>(args, options =>
     {
         options.EnableShellCompletionSupport = false;
         options.TreatPublicMethodsAsCommands = false;
     });
 }
示例#2
0
 internal static CoconaApp RegisterFileCommands(this CoconaApp app)
 {
     app.AddSubCommand("clean", command =>
     {
         command.AddCommand("html", (
                                [FromService] IFileHandlingService fileHandlingService) =>
         {
             fileHandlingService.DeleteHtmlAllFiles();
         })
示例#3
0
文件: Program.cs 项目: kimozex/Cocona
 static async Task Main(string[] args)
 {
     await CoconaApp.Create()
     .ConfigureServices(services =>
     {
         services.AddSingleton <ICoconaValueConverter, JsonValueConverter>();
     })
     .RunAsync <Program>(args);
 }
示例#4
0
 private static async Task Main(string[] args)
 {
     await CoconaApp.Create().ConfigureServices(
         services =>
     {
         services.AddTransient <IFileConfigurationService <RocksDbServiceConfiguration>, RocksDbServiceFileConfigurationService>();
         services.AddTransient <IRocksDbService, RocksDbService>();
         services.AddTransient <IInputOutputErrorContainer, StandardInputOutputErrorContainer>();
     }).RunAsync <RocksDbCommand>(args);
 }
示例#5
0
 static void Main(string[] args)
 {
     System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
     CoconaApp.Create()
     .ConfigureServices(services =>
     {
         services.AddTransient <PMDCompileTestService>();
     })
     .Run <Program>(args);
 }
示例#6
0
 static void Main(string[] args)
 {
     CoconaApp.Create()
     .ConfigureServices((hostContext, services) =>
     {
         services.Configure <ConnectionStringOptions>(hostContext.Configuration);
         services.AddTransient <IChangeSetRepository, ChangeSetAzureStorageRepository>();
         services.AddTransient <IStatusRawDataRepository, StatusRawDataAzureStorageRepository>();
         services.AddTransient <DataUpdateAgent>();
     })
     .Run <Program>(args);
 }
示例#7
0
 static void Main(string[] args)
 {
     CoconaApp.Create()
     .ConfigureLogging(logging =>
     {
         logging.AddDebug();
     })
     .ConfigureServices(services =>
     {
         services.AddTransient <MyService>();
     })
     .Run <Program>(args);
 }
示例#8
0
文件: Program.cs 项目: Stu042/Cy
    public static int Main(string[] args)
    {
        var app = CoconaApp.Create(args, options => {
            options.TreatPublicMethodsAsCommands = true;
            options.EnableShellCompletionSupport = true;
        });

        app.AddCommands <CommandLineCommands>();
        app.Run();
        var services = new ServiceCollection();

        ConfigureServices(services);
        var serviceProvider = services
                              .AddSingleton <CyCompiler, CyCompiler>()
                              .BuildServiceProvider();
        var result = serviceProvider.GetService <CyCompiler>().Compile();

        return(result);
    }
 internal static CoconaApp RegisterUploadCommands(this CoconaApp app)
 {
     app.AddSubCommand("upload", command =>
     {
         command.AddCommand("report", (
                                [FromService] IUploadService uploadService,
                                [Option('d',
                                        Description = "The day which should be uploaded (format: yyyyMMdd). Default is today.")]
                                string?day,
                                [Option('k',
                                        Description = "Uploads all log, but only prints the links to logs that killed the boss.")]
                                bool killOnly,
                                [Option('f',
                                        Description =
                                            "Only uses the logs that are in the list of boss ids (in the config.json file) for the printing links.")]
                                bool filter
                                ) =>
         {
             uploadService.UploadFilesToDpsReport(day, killOnly, filter);
         })
示例#10
0
    static async Task Main(string[] args)
    {
        var builder = CoconaApp
                      .CreateHostBuilder()
                      .ConfigureLogging((ctx, builder) =>
        {
            AddBareConsoleFormatterIfConfigured(ctx, builder);
        })
                      .ConfigureServices((ctx, services) =>
        {
            Configuration = ctx.Configuration;
            RegisterServices(services);
        });

        await builder.RunAsync <Program>(args, options =>
        {
            options.TreatPublicMethodsAsCommands = false;
        });

        await Task.CompletedTask;
    }
示例#11
0
 internal static CoconaApp RegisterParserCommands(this CoconaApp app)
 {
     app.AddSubCommand("parse", command =>
     {
         command.AddCommand("local",
                            ([FromService] IParserService parserService,
                             [Option('d',
                                     Description = "The day which should be parsed (format: yyyyMMdd). Default is today.")]
                             string?day,
                             [Option('r', Description = "Creates the timeline in reverse date order.")]
                             bool reverse,
                             [Option('k', Description = "Only uses the logs that killed the boss for the timeline.")]
                             bool killOnly,
                             [Option('f',
                                     Description =
                                         "Only uses the logs that are in the list of boss ids (in the config.json file) for the timeline.")]
                             bool filter
                            ) =>
         {
             parserService.ParseLogsFromDisk(day, reverse, killOnly, filter);
         })
示例#12
0
 static void Main(string[] args)
 {
     // Cocona parses command-line and executes a command.
     CoconaApp.Run <Program>(args);
 }
示例#13
0
文件: Program.cs 项目: kimozex/Cocona
 static void Main(string[] args)
 {
     CoconaApp.Run <Program>(args);
 }
示例#14
0
 public void ExecuteWithCocona() => CoconaApp.Run <CoconaCommand>(Arguments);
示例#15
0
文件: Program.cs 项目: kimozex/Cocona
 static void Main(string[] args)
 {
     CoconaApp.Run(args, new[] { typeof(Program), typeof(GreeterCommands) });
 }