public override int Run(CacheDestroyCommandOptions options, InvocationContext context)
    {
        var strConfirmDestroy = string.Format(
            CliOutput.CacheDestroyCommandRunner_Run_Prompt,
            options.CacheDir);

        // Unless the --force flag is passed, prompt the user whether they want
        // to destroy the cache
        if (!options.Force && !Confirm(strConfirmDestroy, context))
        {
            context.Console.Out.WriteLine(
                CliOutput.CacheDestroyCommandRunner_Run_Abort);
            return(true.ToExitCode());
        }

        var strDestroyingCache = string.Format(
            CliOutput.CacheDestroyCommandRunner_Run_Destroying,
            options.CacheDir);

        context.Console.Out.WriteLine(strDestroyingCache);

        ActivityEngine.Dispatch(new DestroyCacheActivity(CacheManager, options.CacheDir));

        var exitCode = WaitForCacheDestroyEvents(context);

        return(exitCode);
    }
Exemple #2
0
    public override int Run(EmptyCommandOptions options, InvocationContext context)
    {
        ActivityEngine.Dispatch(new DetectAgentsActivity(AgentsDetector));

        EventEngine.On <AgentsDetectedEvent>(detectionEvent =>
        {
            FormatAndWriteToConsole(detectionEvent.AgentsAndLocations ?? new Dictionary <string, string>());
        });

        ActivityEngine.Wait();

        return(0);
    }