prompt user before rebuilding share

This commit is contained in:
Jörn-Michael Miehe 2025-06-25 23:52:16 +00:00
parent f2b063ba85
commit 3258b8fb74
2 changed files with 20 additions and 3 deletions

View file

@ -90,13 +90,13 @@ fn main() {
match p {
// Error 404 (File not found)
error::Parameter::FileID(fid) => {
info!("requeueing file {fid:?}");
info!("retrying file {fid:?}");
state.abort_upload();
}
// Error 404 (Share not found)
error::Parameter::ShareID(sid) => {
// TODO ask
output::prompt_rebuild_share();
info!("rebuilding share {sid:?}");
// rebuild share

View file

@ -1,7 +1,7 @@
use std::{fmt, process, sync::LazyLock};
use console::{StyledObject, style};
use dialoguer::{Select, theme::ColorfulTheme};
use dialoguer::{Confirm, Select, theme::ColorfulTheme};
use indicatif::{ProgressBar, ProgressStyle};
use log::{error, info};
@ -36,6 +36,23 @@ pub fn prompt_continue() -> bool {
selection == 0
}
pub fn prompt_rebuild_share() {
let prompt = format!(
"Target Share cannot be accessed. {}",
style("Completely restart upload?").cyan()
);
let selection = Confirm::with_theme(&ColorfulTheme::default())
.with_prompt(prompt)
.default(true)
.interact()
.unwrap_or(false);
if selection == false {
process::exit(0);
}
}
pub fn style_all<'t, F>(strs: &[&'t str], f: F) -> Vec<String>
where
F: Fn(StyledObject<&'t str>) -> StyledObject<&'t str>,