Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move is_terminal check after on_conflict check #1381

Merged
merged 1 commit into from
Mar 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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