fn authorize(&mut self, path: &PathBuf, context: Context) -> Result<bool> {
        // Determine the appropriate prompt
        let prompt = match context {
            Context::Absolute => "is absolute",
            Context::Interactive => "mode will be changed",
        };

        let mut input = String::new();
        loop {
            // Prompt the user and normalize the input
            write!(self.stderr, r#""{}" {} - continue? [y/n] "#, path.display(), prompt)?;
            self.stdin.read_line(&mut input)?;

            // The response must be `y` or `n`
            match input.trim().to_lowercase().as_str() {
                "n" => {
                    if self.options.verbose {
                        writeln!(self.stderr, "Skipped.")?;
                    }
                    return Ok(false);
                },
                "y" => {
                    return Ok(true);
                },
                _ => {
                    input.clear();
                },
            }
        }
    }
/// Authorizes directory and file access by prompting the user and reading
/// from the standard input stream.
Authorizes directory and file access by prompting the user and reading
from the standard input stream.
Authorizes directory and file access by prompting the user and reading from the standard input stream .
fn authorize(&mut self, path: &PathBuf, context: Context) -> Result<bool> {
        // Determine the appropriate prompt
        let prompt = match context {
            Context::Absolute => "is absolute",
            Context::Interactive => "mode will be changed",
        };
        let mut input = String::new();
        loop {
            // Prompt the user and normalize the input
            write!(self.stderr, r#""{}" {} - continue? [y/n] "#, path.display(), prompt)?;
            self.stdin.read_line(&mut input)?;
            // The response must be `y` or `n`
            match input.trim().to_lowercase().as_str() {
                "n" => {
                    if self.options.verbose {
                        writeln!(self.stderr, "Skipped.")?;
                    }
                    return Ok(false);
                },
                "y" => {
                    return Ok(true);
                },
                _ => {
                    input.clear();
                },
            }
        }
    }
fn authorize ( & mut self , path : & PathBuf , context : Context ) -> Result < bool > { // Determine the appropriate prompt let prompt = match context { Context :: Absolute => " " , Context :: Interactive => " " , } ; let mut input = String :: new ( ) ; loop { // Prompt the user and normalize the input write ! ( self stderr r#""{}" {} - continue? [y/n] "# path display ( ) prompt ) ? ; self . stdin . read_line ( & mut input ) ? ; // The response must be `y` or `n` match input . trim ( ) . to_lowercase ( ) . as_str ( ) { " " => { if self . options . verbose { writeln ! ( self stderr " " ) ? ; } return Ok ( false ) ; } , " " => { return Ok ( true ) ; } , _ => { input . clear ( ) ; } , } } }
Authorizes directory and file access by prompting the user and reading
from the standard input stream.
Authorizes directory and file access by prompting the user and reading from the standard input stream .
&mut self
path
&PathBuf
context
Context