Remove pending transfer with storage (use action)

This commit is contained in:
veeso
2021-12-13 12:32:16 +01:00
committed by Christian Visintin
parent 197b3095b6
commit e047179ea0
7 changed files with 106 additions and 148 deletions

View File

@@ -183,20 +183,10 @@ impl ProgressStates {
// -- Options
/// Defines the transfer options for transfer actions
#[derive(Default)]
pub struct TransferOpts {
/// Save file as
pub save_as: Option<String>,
/// Whether to check if file is being replaced
pub check_replace: bool,
}
impl Default for TransferOpts {
fn default() -> Self {
Self {
save_as: None,
check_replace: true,
}
}
}
impl TransferOpts {
@@ -205,12 +195,6 @@ impl TransferOpts {
self.save_as = n.map(|x| x.as_ref().to_string());
self
}
/// Set whether to check if the file being transferred will "replace" an existing one
pub fn check_replace(mut self, opt: bool) -> Self {
self.check_replace = opt;
self
}
}
#[cfg(test)]
@@ -289,12 +273,8 @@ mod test {
#[test]
fn transfer_opts() {
let opts = TransferOpts::default();
assert_eq!(opts.check_replace, true);
assert!(opts.save_as.is_none());
let opts = TransferOpts::default()
.check_replace(false)
.save_as(Some("omar.txt"));
let opts = TransferOpts::default().save_as(Some("omar.txt"));
assert_eq!(opts.save_as.as_deref().unwrap(), "omar.txt");
assert_eq!(opts.check_replace, false);
}
}