pub struct Ask<R, W> { /* private fields */ }Expand description
The default: shows the warning and waits for the word yes.
The streams are whatever the caller hands over, which in the binary means
stdin and stderr rather than the controlling terminal. Two consequences
worth knowing rather than discovering: git-xcrypt lock < answers.txt
proceeds if the first line is yes, and git-xcrypt lock 2>/dev/null waits
on a prompt nobody can see. Opening /dev/tty instead would fix both on Unix
and has no portable equivalent, and this binary ships on Windows too.
Implementations§
Trait Implementations§
Source§impl<R: BufRead, W: Write> Confirm for Ask<R, W>
impl<R: BufRead, W: Write> Confirm for Ask<R, W>
Source§fn confirm(&mut self, warning: &Warning) -> Result<bool>
fn confirm(&mut self, warning: &Warning) -> Result<bool>
Accepts the exact word yes and nothing else.
Not y, not YES: the founding document asks for a word typed in full
because the point of the prompt is to interrupt a reflex. End of input —
a run with no terminal behind it, lock < /dev/null in a script — reads
as a refusal, which is the direction that changes nothing.