refactor: Use top-level statements for Spark.Console 'main'
This commit is contained in:
1 parent
0c5e9c6945
commit
33f42c3097
1 file changed
+35
-41
@@ -1,45 +1,39 @@
|
||||
namespace Spark.Console {
|
||||
using bts;
|
||||
using bts.utils;
|
||||
using bts.utils;
|
||||
|
||||
using System;
|
||||
using CommandLine;
|
||||
|
||||
using CommandLine;
|
||||
using Spark.Console;
|
||||
|
||||
class Program {
|
||||
static int Main(string[] args) {
|
||||
// Initializing config is up to each individual command
|
||||
// We call provide_command_line here in case config is first
|
||||
// initialized from c++ instead of c#
|
||||
BTSNativeMethods.provide_command_line(args, args.Length);
|
||||
using System;
|
||||
|
||||
var parser = new Parser(ps => {
|
||||
ps.CaseInsensitiveEnumValues = true;
|
||||
ps.HelpWriter = Console.Out;
|
||||
});
|
||||
|
||||
// Note: this can be made to infer the options type list from the list of delegates
|
||||
return parser.parse_and_run<
|
||||
ConfigCommandOptions,
|
||||
ScriptCommandOptions,
|
||||
TailServiceOptions,
|
||||
TestServiceOptions,
|
||||
SettingsCommandOptions,
|
||||
TestCommandOptions,
|
||||
OrderStressOptions,
|
||||
MBOCommandOptions,
|
||||
int
|
||||
>(
|
||||
args,
|
||||
ConfigCommand.run,
|
||||
ScriptCommand.run,
|
||||
TailService.run,
|
||||
TestService.run,
|
||||
SettingsCommand.run,
|
||||
TestCommand.run,
|
||||
OrderStressCommand.run,
|
||||
MBOCommand.run,
|
||||
errors => 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Initializing config is up to each individual command
|
||||
// We call provide_command_line here in case config is first
|
||||
// initialized from c++ instead of c#
|
||||
BTSNativeMethods.provide_command_line(args, args.Length);
|
||||
var parser = new Parser(ps => {
|
||||
ps.CaseInsensitiveEnumValues = true;
|
||||
ps.HelpWriter = Console.Out;
|
||||
});
|
||||
// Note: this can be made to infer the options type list from the list of delegates
|
||||
var exitCode = parser.parse_and_run<
|
||||
ConfigCommandOptions,
|
||||
ScriptCommandOptions,
|
||||
TailServiceOptions,
|
||||
TestServiceOptions,
|
||||
SettingsCommandOptions,
|
||||
TestCommandOptions,
|
||||
OrderStressOptions,
|
||||
MBOCommandOptions,
|
||||
int
|
||||
>(
|
||||
args,
|
||||
ConfigCommand.run,
|
||||
ScriptCommand.run,
|
||||
TailService.run,
|
||||
TestService.run,
|
||||
SettingsCommand.run,
|
||||
TestCommand.run,
|
||||
OrderStressCommand.run,
|
||||
MBOCommand.run,
|
||||
errors => 1);
|
||||
Environment.Exit(exitCode);
|
||||
Reference in new issue
Block a user