Skip to main content

resolve_prompt

Function resolve_prompt 

Source
pub fn resolve_prompt(
    file_flag: Option<&str>,
    positional: &[String],
    stdin_is_terminal: bool,
) -> Result<String>
Expand description

Resolve the prompt text from the available sources.

Priority / conflict rules:

  1. --file and positional prompt args are mutually exclusive (Usage error).
  2. --file - reads all of stdin.
  3. --file <path> reads the file at that path.
  4. If no --file but stdin is piped (not a TTY), read stdin as the prompt.
  5. Otherwise, join the positional prompt words.