prompt method

Future<String> prompt(
  1. String text
)

Reads a single line of input after showing text, for a local command that needs an answer (e.g. a :download confirmation).

The next committed line completes the returned future instead of being run as a command or added to history; Ctrl-C cancels it (completing with ''). Works even though the triggering command is still running, because input is only gated when no prompt is pending.

Implementation

Future<String> prompt(String text) {
  final completer = Completer<String>();
  _promptCompleter = completer;
  _buffer.clear();
  _cursor = 0;
  setPrompt(text);
  return completer.future;
}