diff --git a/src/bin/shrupl.rs b/src/bin/shrupl.rs index 9ae6ede..31ac3e9 100644 --- a/src/bin/shrupl.rs +++ b/src/bin/shrupl.rs @@ -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 diff --git a/src/output.rs b/src/output.rs index 7e52946..aa17cd4 100644 --- a/src/output.rs +++ b/src/output.rs @@ -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 where F: Fn(StyledObject<&'t str>) -> StyledObject<&'t str>,