prompt user before rebuilding share
This commit is contained in:
parent
f2b063ba85
commit
3258b8fb74
2 changed files with 20 additions and 3 deletions
|
|
@ -90,13 +90,13 @@ fn main() {
|
||||||
match p {
|
match p {
|
||||||
// Error 404 (File not found)
|
// Error 404 (File not found)
|
||||||
error::Parameter::FileID(fid) => {
|
error::Parameter::FileID(fid) => {
|
||||||
info!("requeueing file {fid:?}");
|
info!("retrying file {fid:?}");
|
||||||
|
|
||||||
state.abort_upload();
|
state.abort_upload();
|
||||||
}
|
}
|
||||||
// Error 404 (Share not found)
|
// Error 404 (Share not found)
|
||||||
error::Parameter::ShareID(sid) => {
|
error::Parameter::ShareID(sid) => {
|
||||||
// TODO ask
|
output::prompt_rebuild_share();
|
||||||
info!("rebuilding share {sid:?}");
|
info!("rebuilding share {sid:?}");
|
||||||
|
|
||||||
// rebuild share
|
// rebuild share
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use std::{fmt, process, sync::LazyLock};
|
use std::{fmt, process, sync::LazyLock};
|
||||||
|
|
||||||
use console::{StyledObject, style};
|
use console::{StyledObject, style};
|
||||||
use dialoguer::{Select, theme::ColorfulTheme};
|
use dialoguer::{Confirm, Select, theme::ColorfulTheme};
|
||||||
use indicatif::{ProgressBar, ProgressStyle};
|
use indicatif::{ProgressBar, ProgressStyle};
|
||||||
use log::{error, info};
|
use log::{error, info};
|
||||||
|
|
||||||
|
|
@ -36,6 +36,23 @@ pub fn prompt_continue() -> bool {
|
||||||
selection == 0
|
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>
|
pub fn style_all<'t, F>(strs: &[&'t str], f: F) -> Vec<String>
|
||||||
where
|
where
|
||||||
F: Fn(StyledObject<&'t str>) -> StyledObject<&'t str>,
|
F: Fn(StyledObject<&'t str>) -> StyledObject<&'t str>,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue