Program.cs 528 B

1234567891011121314151617
  1. using System.Linq;
  2. using ArcToolkitCLI.Commands;
  3. using CommandLine;
  4. namespace ArcToolkitCLI
  5. {
  6. internal class Program
  7. {
  8. private static int Main(string[] args)
  9. {
  10. var commandTypes = typeof(Program).Assembly.GetTypes()
  11. .Where(t => !t.IsInterface && !t.IsAbstract && typeof(ICommand).IsAssignableFrom(t)).ToArray();
  12. return Parser.Default.ParseArguments(args, commandTypes)
  13. .MapResult((object t) => ((ICommand) t).Run(), errs => 1);
  14. }
  15. }
  16. }