public int Run(string bounceDirectory, string [] rawArguments) { try { Directory.SetCurrentDirectory(Path.GetDirectoryName(bounceDirectory)); var parameters = ParsedArguments(rawArguments); Parameters.Main = new Parameters(parameters); var dependencyResolver = new AttributedDependencyResolvers(); var tasks = Tasks(bounceDirectory, dependencyResolver); if (rawArguments.Length > 0) { TaskRunner.RunTask(TaskName(rawArguments), parameters, tasks); } else { UsageHelp.WriteUsage(Console.Out, tasks); } return(0); } catch (BounceException e) { e.Explain(Console.Error); return(1); } catch (ReflectionTypeLoadException e) { foreach (var loaderException in e.LoaderExceptions) { Console.Error.WriteLine(loaderException); } return(1); } catch (Exception e) { Console.Error.WriteLine(e); return(1); } }
public override void Explain(System.IO.TextWriter stderr) { stderr.WriteLine("task `{0}' not found, try one of the following:", _taskName); UsageHelp.WriteAvailableTasks(stderr, _tasks); }