Skip to content

Commit

Permalink
fix: cli file collision resolution in non-interactive settings (#1381)
Browse files Browse the repository at this point in the history
fixes program not using on_conflict when terminal non-interactive
  • Loading branch information
LeSnake04 authored Mar 6, 2025
1 parent 0fcb985 commit 119e951
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions crates/rnote-cli/src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,6 @@ pub(crate) fn file_conflict_prompt_action(
if !output_file.exists() {
return Ok(None);
}
if !io::stdout().is_terminal() {
return Err(anyhow::anyhow!(
"File conflict for file \"{}\" detected and terminal is not interactive. Option \"--on-conflict\" needs to be supplied.",
output_file.display()
));
}
match on_conflict_overwrite {
Some(o) => on_conflict = *o,
None => {
Expand All @@ -452,6 +446,12 @@ pub(crate) fn file_conflict_prompt_action(
OnConflict::AlwaysSuffix,
];
while matches!(on_conflict, OnConflict::Ask) {
if !io::stdout().is_terminal() {
return Err(anyhow::anyhow!(
"File conflict for file \"{}\" detected and terminal is not interactive. Option \"--on-conflict\" needs to be supplied.",
output_file.display()
));
}
match dialoguer::Select::new()
.with_prompt(format!(
"File \"{}\" already exists:",
Expand Down

0 comments on commit 119e951

Please sign in to comment.