mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 01:26:04 -08:00
fmt
This commit is contained in:
@@ -40,9 +40,7 @@ impl Builder {
|
|||||||
}
|
}
|
||||||
(protocol, params) => {
|
(protocol, params) => {
|
||||||
error!("Invalid params for protocol '{:?}'", protocol);
|
error!("Invalid params for protocol '{:?}'", protocol);
|
||||||
panic!(
|
panic!("Invalid protocol '{protocol:?}' with parameters of type {params:?}")
|
||||||
"Invalid protocol '{protocol:?}' with parameters of type {params:?}"
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,7 @@ pub fn init(level: LogLevel) -> Result<(), String> {
|
|||||||
// Prepare log config
|
// Prepare log config
|
||||||
let config = ConfigBuilder::new().set_time_format_rfc3339().build();
|
let config = ConfigBuilder::new().set_time_format_rfc3339().build();
|
||||||
// Make logger
|
// Make logger
|
||||||
WriteLogger::init(level, config, file)
|
WriteLogger::init(level, config, file).map_err(|e| format!("Failed to initialize logger: {e}"))
|
||||||
.map_err(|e| format!("Failed to initialize logger: {e}"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@@ -158,9 +158,7 @@ impl FileTransferActivity {
|
|||||||
trace!("The user doesn't want to create the directory; disabling synchronized browsing");
|
trace!("The user doesn't want to create the directory; disabling synchronized browsing");
|
||||||
self.log(
|
self.log(
|
||||||
LogLevel::Warn,
|
LogLevel::Warn,
|
||||||
format!(
|
format!("Refused to create '{name}'; synchronized browsing disabled"),
|
||||||
"Refused to create '{name}'; synchronized browsing disabled"
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
self.browser.toggle_sync_browsing();
|
self.browser.toggle_sync_browsing();
|
||||||
self.refresh_remote_status_bar();
|
self.refresh_remote_status_bar();
|
||||||
|
|||||||
@@ -17,10 +17,7 @@ impl FileTransferActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if file_exists {
|
if file_exists {
|
||||||
self.log_and_alert(
|
self.log_and_alert(LogLevel::Warn, format!("File \"{input}\" already exists",));
|
||||||
LogLevel::Warn,
|
|
||||||
format!("File \"{input}\" already exists",),
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Create file
|
// Create file
|
||||||
@@ -47,20 +44,16 @@ impl FileTransferActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if file_exists {
|
if file_exists {
|
||||||
self.log_and_alert(
|
self.log_and_alert(LogLevel::Warn, format!("File \"{input}\" already exists",));
|
||||||
LogLevel::Warn,
|
|
||||||
format!("File \"{input}\" already exists",),
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Get path on remote
|
// Get path on remote
|
||||||
let file_path: PathBuf = PathBuf::from(input.as_str());
|
let file_path: PathBuf = PathBuf::from(input.as_str());
|
||||||
// Create file (on local)
|
// Create file (on local)
|
||||||
match tempfile::NamedTempFile::new() {
|
match tempfile::NamedTempFile::new() {
|
||||||
Err(err) => self.log_and_alert(
|
Err(err) => {
|
||||||
LogLevel::Error,
|
self.log_and_alert(LogLevel::Error, format!("Could not create tempfile: {err}"))
|
||||||
format!("Could not create tempfile: {err}"),
|
}
|
||||||
),
|
|
||||||
Ok(tfile) => {
|
Ok(tfile) => {
|
||||||
// Stat tempfile
|
// Stat tempfile
|
||||||
let local_file: File = match self.host.stat(tfile.path()) {
|
let local_file: File = match self.host.stat(tfile.path()) {
|
||||||
|
|||||||
@@ -27,10 +27,7 @@ impl FileTransferActivity {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
self.log_and_alert(
|
self.log_and_alert(LogLevel::Error, format!("Could not create symlink: {err}"));
|
||||||
LogLevel::Error,
|
|
||||||
format!("Could not create symlink: {err}"),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user