Ejemplo n.º 1
0
    public async Task RunMiruAsync(
        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'
        await processRunner.RunAsync(new ProcessSpec
        {
            Executable       = "dotnet",
            Arguments        = mergedArgs,
            WorkingDirectory = solution.AppDir
        });
    }
Ejemplo n.º 2
0
    public async Task RunAtAsync(
        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);

        await processRunner.RunAsync(new ProcessSpec()
        {
            Executable       = exec,
            Arguments        = runOptions.Args,
            WorkingDirectory = directory(solution)
        });
    }