40 lines
1.5 KiB
C#
40 lines
1.5 KiB
C#
using bts.api;
|
|
using bts.api.core;
|
|
using bts.api.synthetic;
|
|
using bts.api.test;
|
|
using System;
|
|
using System.Linq;
|
|
using CommandLine;
|
|
using bts;
|
|
using System.Collections.Generic;
|
|
using System.Linq.Expressions;
|
|
using System.Reflection;
|
|
|
|
namespace sparkcmd {
|
|
class Program {
|
|
|
|
// static object option<T>(Func<T,int> run) {return run;}
|
|
// static Type argType(object arg) {
|
|
// return arg.GetType().GetGenericArguments().First();
|
|
// }
|
|
// static int Run(Func<IEnumerable<Error>,int> on_error, params object[] args) {
|
|
// var types = args.Select(argType).ToArray();
|
|
// var parse = CommandLine.Parser.Default.GetType().GetMethod("ParseArguments", BindingFlags.Public).MakeGenericMethod(types);
|
|
// return 3;
|
|
// }
|
|
static int Main(string[] args) {
|
|
mbts.utils.BTSNativeMethods.provide_command_line(args, args.Length);
|
|
// note: this can be made to infer the options type list from the list of delegates
|
|
return Parser.Default
|
|
.ParseArguments<ConfigcheckOptions,ScriptClientOptions,TailServiceOptions,ServiceTestOptions,SettingsManagerOptions,TestCommandOptions >(args)
|
|
.MapResult<ConfigcheckOptions,ScriptClientOptions,TailServiceOptions,ServiceTestOptions,SettingsManagerOptions,TestCommandOptions,int>(
|
|
Configcheck.Run,
|
|
ScriptClientCommand.Run,
|
|
TailService.Run,
|
|
ServiceTest.Run,
|
|
SettingsManagerCommand.Run,
|
|
TestCommand.Run,
|
|
errors => 1);
|
|
}
|
|
}
|
|
} |