Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var parser    = new ArgumentParser();
            var container = new TaskContainer();
            var executor  = new TaskExecutor(container, parser);

            container.Add(new HelpTaskRunner(container));
            container.Add(new TaskListTaskRunner(container));
            container.Add(new ArgumentDisplayTaskRunner());
            container.Add(new AssemblyModuleBuilderTaskRunner());
            container.Add(new PackTaskRunner());
            container.Add(new InstallTaskRunner());
            container.Add(new InstallAllTaskRunner());

            Stopwatch timer = new Stopwatch();

            timer.Start();
            if (args.Length == 0)
            {
                executor.ExecuteTask("list", args);
                Environment.Exit(0);
            }

            var result = executor.ExecuteTask(args[0], args.Skip(1).ToArray());

            foreach (var exception in result.RaisedExceptions)
            {
                Console.WriteLine(exception.Message);
            }

            timer.Stop();
            Console.WriteLine($"Completed in {timer.Elapsed.ToString("c")}.");
            Environment.Exit(result.ExitCode);
        }