Skip to content
Cake AddIn that extends Cake with interactive user prompts
Branch: master
Clone or download
Pull request Compare This branch is 18 commits ahead of yvschmid:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
LICENSE
README.md Update README.md Jan 3, 2019

README.md

Cake.Prompt

Cake AddIn that extends Cake with interactive user prompts.

Build status

Definition

/// <summary>
/// Prompts the user for input.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="message">The message which is shown to the user.</param>
/// <param name="defaultResult">Value supplied if the user simply returns with no input</param>
/// <param name="timeout">Timeout time, defaults to 30 seconds</param>
/// <returns>The user input.</returns>
string Prompt(this ICakeContext context, string message, string defaultResult = default, TimeSpan timeout = default);

Usage

NuGetPush(packagePath, new NuGetPushSettings {
    ApiKey = Prompt("Enter api key for NuGetPush:")
});
var continue = Prompt("Do you want to continue? [Y/N]", "N").Trim().ToUpperInvariant() == "Y";
if (continue)
    ...

The Prompt() method throws a TimeoutException after the supplied timeout duration (Defaults to 30 seconds).

You can’t perform that action at this time.