public void RunAt( MiruCliOptions options, RunOptions runOptions, Func <MiruSolution, MiruPath> directory) { var result = FindSolution(options); if (result.FoundSolution == false) { Console2.RedLine($"There is no Miru's Solution at {result.LookedAt}"); return; } var solution = result.Solution; var exec = OS.IsWindows ? OS.WhereOrWhich(runOptions.Executable) : runOptions.Executable; var processRunner = new MiruProcessRunner(options.Verbose, string.Empty); var proc = processRunner.RunAsync(new ProcessSpec() { Executable = exec, Arguments = runOptions.Args, WorkingDirectory = directory(solution) }); Task.WaitAll(proc); }
public void RunMiru( MiruCliOptions options, RunMiruOptions runMiruOptions) { var result = FindSolution(options); if (result.FoundSolution == false) { Console2.RedLine($"There is no Miru's Solution at {result.LookedAt}"); return; } var solution = result.Solution; var processRunner = new MiruProcessRunner(options.Verbose); var mergedArgs = new List <string>(); mergedArgs.AddRange(new[] { "run", "--no-build", "--", "miru" }); if (runMiruOptions.MiruArgs?.Length > 0) { mergedArgs.AddRange(runMiruOptions.MiruArgs); } // TODO: handle exception: error when running 'command' var proc = processRunner.RunAsync(new ProcessSpec { Executable = "dotnet", Arguments = mergedArgs, WorkingDirectory = solution.AppDir }); Task.WaitAll(proc); }
private SolutionFinderResult FindSolution(MiruCliOptions options) { var solutionDir = options.Project.IsNotEmpty() ? options.Project : Directory.GetCurrentDirectory(); return(new SolutionFinder().FromDir(solutionDir)); }