/// Check if QuestionPolicy flags were set, otherwise, ask user if they want to overwrite.
Check if QuestionPolicy flags were set, otherwise, ask user if they want to overwrite.
Check if QuestionPolicy flags were set otherwise ask user if they want to overwrite .
pub fn user_wants_to_overwrite(path: &Path, question_policy: QuestionPolicy) -> crate::Result<bool> {
    match question_policy {
        QuestionPolicy::AlwaysYes => Ok(true),
        QuestionPolicy::AlwaysNo => Ok(false),
        QuestionPolicy::Ask => {
            let path = to_utf(strip_cur_dir(path));
            let path = Some(path.as_str());
            let placeholder = Some("FILE");
            Confirmation::new("Do you want to overwrite 'FILE'?", placeholder).ask(path)
        }
    }
}
pub fn user_wants_to_overwrite ( path : & Path , question_policy : QuestionPolicy ) -> crate :: Result < bool > { match question_policy { QuestionPolicy :: AlwaysYes => Ok ( true ) , QuestionPolicy :: AlwaysNo => Ok ( false ) , QuestionPolicy :: Ask => { let path = to_utf ( strip_cur_dir ( path ) ) ; let path = Some ( path . as_str ( ) ) ; let placeholder = Some ( " " ) ; Confirmation :: new ( " " , placeholder ) . ask ( path ) } } }
Check if QuestionPolicy flags were set, otherwise, ask user if they want to overwrite.
Check if QuestionPolicy flags were set otherwise ask user if they want to overwrite .
path
&Path
question_policy
QuestionPolicy