update use
This commit is contained in:
20
src/main.rs
20
src/main.rs
@@ -10,10 +10,7 @@ mod opt;
|
||||
use std::{
|
||||
time::SystemTime,
|
||||
path::Path,
|
||||
fs::{
|
||||
self,
|
||||
File,
|
||||
},
|
||||
fs::{ self, File, },
|
||||
};
|
||||
use rust_util::{
|
||||
iff,
|
||||
@@ -39,8 +36,7 @@ fn main() -> XResult<()> {
|
||||
}
|
||||
|
||||
let config_json = match get_config_json(iff!(options.config.is_empty(), None, Some(&options.config)), options.verbose) {
|
||||
None => return Ok(()),
|
||||
Some(c) => c,
|
||||
Some(c) => c, None => return Ok(()),
|
||||
};
|
||||
|
||||
let oss_backupd_config = parse_config(&config_json);
|
||||
@@ -93,8 +89,7 @@ fn process_config_item(options: &Options, config_item: &OSSBackupdConfigItem,
|
||||
}
|
||||
|
||||
let path = &match &oss_config.path {
|
||||
None => format!("default_path_at_{}", item_index),
|
||||
Some(path) => path.to_owned(),
|
||||
Some(path) => path.to_owned(), None => format!("default_path_at_{}", item_index),
|
||||
};
|
||||
if options.verbose {
|
||||
print_message(MessageType::DEBUG, &format!("Path: {}", path));
|
||||
@@ -112,11 +107,10 @@ fn process_config_item(options: &Options, config_item: &OSSBackupdConfigItem,
|
||||
}
|
||||
|
||||
let open_pgp_tool = match OpenPGPTool::from_file(encrypt_pubkey_file) {
|
||||
Err(e) => {
|
||||
Ok(t) => t, Err(e) => {
|
||||
print_message(MessageType::ERROR, &format!("Error in load pgp file: {}, at item index: {}", e, item_index));
|
||||
return Ok(());
|
||||
},
|
||||
Ok(open_pgp_tool) => open_pgp_tool,
|
||||
};
|
||||
|
||||
let secs = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_secs();
|
||||
@@ -152,12 +146,11 @@ fn process_config_item(options: &Options, config_item: &OSSBackupdConfigItem,
|
||||
};
|
||||
|
||||
let file_temp_pgp_file = match File::open(temp_pgp_file) {
|
||||
Err(e) => {
|
||||
Ok(f) => f, Err(e) => {
|
||||
print_message(MessageType::ERROR, &format!("Error in open file: {}, at item index: {}", e, item_index));
|
||||
remove_temp_files();
|
||||
return Ok(());
|
||||
},
|
||||
Ok(file_temp_pgp_file) => file_temp_pgp_file,
|
||||
};
|
||||
|
||||
if options.verbose {
|
||||
@@ -187,8 +180,7 @@ fn process_oss_files(options: &Options, oss_client: &OSSClient, bucket_name: &st
|
||||
print_message(MessageType::DEBUG, &format!("Read meta file: {}", meta_file_key));
|
||||
}
|
||||
let meta_file_content = match oss_client.get_file_content(bucket_name, meta_file_key)? {
|
||||
None => "[]".to_owned(),
|
||||
Some(c) => c,
|
||||
Some(c) => c, None => "[]".to_owned(),
|
||||
};
|
||||
if options.verbose {
|
||||
print_message(MessageType::DEBUG, &format!("Read meta file content: {}", &meta_file_content));
|
||||
|
||||
Reference in New Issue
Block a user