mirror of
https://github.com/veeso/termscp.git
synced 2026-09-12 07:06:02 -07:00
lint
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
authors = ["Christian Visintin"]
|
authors = ["Christian Visintin <christian.visintin1997@gmail.com>"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
description = "termscp is a feature rich terminal file transfer and explorer with support for SCP/SFTP/FTP/S3"
|
description = "termscp is a feature rich terminal file transfer and explorer with support for SCP/SFTP/FTP/S3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ pub struct UserHosts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Bookmark describes a single bookmark entry in the user hosts storage
|
/// Bookmark describes a single bookmark entry in the user hosts storage
|
||||||
#[derive(Clone, Deserialize, Serialize, Debug, PartialEq)]
|
#[derive(Clone, Deserialize, Serialize, Debug, PartialEq, Eq)]
|
||||||
pub struct Bookmark {
|
pub struct Bookmark {
|
||||||
#[serde(
|
#[serde(
|
||||||
deserialize_with = "deserialize_protocol",
|
deserialize_with = "deserialize_protocol",
|
||||||
@@ -41,7 +41,7 @@ pub struct Bookmark {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Connection parameters for Aws s3 protocol
|
/// Connection parameters for Aws s3 protocol
|
||||||
#[derive(Clone, Deserialize, Serialize, Debug, PartialEq, Default)]
|
#[derive(Clone, Deserialize, Serialize, Debug, PartialEq, Eq, Default)]
|
||||||
pub struct S3Params {
|
pub struct S3Params {
|
||||||
pub bucket: String,
|
pub bucket: String,
|
||||||
pub region: Option<String>,
|
pub region: Option<String>,
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ mod tests {
|
|||||||
assert_eq!(ui.file_fmt, Some(String::from("{NAME}")));
|
assert_eq!(ui.file_fmt, Some(String::from("{NAME}")));
|
||||||
let cfg: UserConfig = UserConfig {
|
let cfg: UserConfig = UserConfig {
|
||||||
user_interface: ui,
|
user_interface: ui,
|
||||||
remote: remote,
|
remote,
|
||||||
};
|
};
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*cfg.remote
|
*cfg.remote
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use tuirealm::tui::style::Color;
|
|||||||
/// ### Theme
|
/// ### Theme
|
||||||
///
|
///
|
||||||
/// Theme contains all the colors lookup table for termscp
|
/// Theme contains all the colors lookup table for termscp
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
|
||||||
pub struct Theme {
|
pub struct Theme {
|
||||||
// -- auth
|
// -- auth
|
||||||
#[serde(
|
#[serde(
|
||||||
|
|||||||
+7
-7
@@ -25,7 +25,7 @@ bitflags! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// FileSorting defines the criteria for sorting files
|
/// FileSorting defines the criteria for sorting files
|
||||||
#[derive(Copy, Clone, PartialEq, std::fmt::Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, std::fmt::Debug)]
|
||||||
pub enum FileSorting {
|
pub enum FileSorting {
|
||||||
Name,
|
Name,
|
||||||
ModifyTime,
|
ModifyTime,
|
||||||
@@ -34,7 +34,7 @@ pub enum FileSorting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// GroupDirs defines how directories should be grouped in sorting files
|
/// GroupDirs defines how directories should be grouped in sorting files
|
||||||
#[derive(PartialEq, std::fmt::Debug)]
|
#[derive(PartialEq, Eq, std::fmt::Debug)]
|
||||||
pub enum GroupDirs {
|
pub enum GroupDirs {
|
||||||
First,
|
First,
|
||||||
Last,
|
Last,
|
||||||
@@ -318,8 +318,8 @@ mod tests {
|
|||||||
explorer.stack_size = 2;
|
explorer.stack_size = 2;
|
||||||
explorer.dirstack = VecDeque::with_capacity(2);
|
explorer.dirstack = VecDeque::with_capacity(2);
|
||||||
// Push dir
|
// Push dir
|
||||||
explorer.pushd(&Path::new("/tmp"));
|
explorer.pushd(Path::new("/tmp"));
|
||||||
explorer.pushd(&Path::new("/home/omar"));
|
explorer.pushd(Path::new("/home/omar"));
|
||||||
// Pop
|
// Pop
|
||||||
assert_eq!(explorer.popd().unwrap(), PathBuf::from("/home/omar"));
|
assert_eq!(explorer.popd().unwrap(), PathBuf::from("/home/omar"));
|
||||||
assert_eq!(explorer.dirstack.len(), 1);
|
assert_eq!(explorer.dirstack.len(), 1);
|
||||||
@@ -328,9 +328,9 @@ mod tests {
|
|||||||
// Dirstack is empty now
|
// Dirstack is empty now
|
||||||
assert!(explorer.popd().is_none());
|
assert!(explorer.popd().is_none());
|
||||||
// Exceed limit
|
// Exceed limit
|
||||||
explorer.pushd(&Path::new("/tmp"));
|
explorer.pushd(Path::new("/tmp"));
|
||||||
explorer.pushd(&Path::new("/home/omar"));
|
explorer.pushd(Path::new("/home/omar"));
|
||||||
explorer.pushd(&Path::new("/dev"));
|
explorer.pushd(Path::new("/dev"));
|
||||||
assert_eq!(explorer.dirstack.len(), 2);
|
assert_eq!(explorer.dirstack.len(), 2);
|
||||||
assert_eq!(*explorer.dirstack.get(1).unwrap(), PathBuf::from("/dev"));
|
assert_eq!(*explorer.dirstack.get(1).unwrap(), PathBuf::from("/dev"));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ pub use params::{FileTransferParams, ProtocolParams};
|
|||||||
|
|
||||||
/// This enum defines the different transfer protocol available in termscp
|
/// This enum defines the different transfer protocol available in termscp
|
||||||
|
|
||||||
#[derive(PartialEq, Debug, Clone, Copy)]
|
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
|
||||||
pub enum FileTransferProtocol {
|
pub enum FileTransferProtocol {
|
||||||
Sftp,
|
Sftp,
|
||||||
Scp,
|
Scp,
|
||||||
|
|||||||
+6
-6
@@ -654,7 +654,7 @@ mod tests {
|
|||||||
let entries = std::fs::read_dir(PathBuf::from("/dev").as_path()).unwrap();
|
let entries = std::fs::read_dir(PathBuf::from("/dev").as_path()).unwrap();
|
||||||
let mut counter: usize = 0;
|
let mut counter: usize = 0;
|
||||||
for _ in entries {
|
for _ in entries {
|
||||||
counter = counter + 1;
|
counter += 1;
|
||||||
}
|
}
|
||||||
assert_eq!(host.files.len(), counter);
|
assert_eq!(host.files.len(), counter);
|
||||||
}
|
}
|
||||||
@@ -696,7 +696,7 @@ mod tests {
|
|||||||
let entries = std::fs::read_dir(PathBuf::from("/dev").as_path()).unwrap();
|
let entries = std::fs::read_dir(PathBuf::from("/dev").as_path()).unwrap();
|
||||||
let mut counter: usize = 0;
|
let mut counter: usize = 0;
|
||||||
for _ in entries {
|
for _ in entries {
|
||||||
counter = counter + 1;
|
counter += 1;
|
||||||
}
|
}
|
||||||
assert_eq!(host.list_dir().len(), counter);
|
assert_eq!(host.list_dir().len(), counter);
|
||||||
}
|
}
|
||||||
@@ -709,10 +709,10 @@ mod tests {
|
|||||||
assert!(host.change_wrkdir(new_dir.as_path()).is_ok());
|
assert!(host.change_wrkdir(new_dir.as_path()).is_ok());
|
||||||
// Verify new files
|
// Verify new files
|
||||||
// Scan dir
|
// Scan dir
|
||||||
let entries = std::fs::read_dir(PathBuf::from(new_dir).as_path()).unwrap();
|
let entries = std::fs::read_dir(new_dir.as_path()).unwrap();
|
||||||
let mut counter: usize = 0;
|
let mut counter: usize = 0;
|
||||||
for _ in entries {
|
for _ in entries {
|
||||||
counter = counter + 1;
|
counter += 1;
|
||||||
}
|
}
|
||||||
assert_eq!(host.files.len(), counter);
|
assert_eq!(host.files.len(), counter);
|
||||||
}
|
}
|
||||||
@@ -793,7 +793,7 @@ mod tests {
|
|||||||
let files: Vec<File> = host.list_dir();
|
let files: Vec<File> = host.list_dir();
|
||||||
// Verify files
|
// Verify files
|
||||||
let file_0: &File = files.get(0).unwrap();
|
let file_0: &File = files.get(0).unwrap();
|
||||||
if file_0.name() == String::from("foo.txt") {
|
if file_0.name() == *"foo.txt" {
|
||||||
assert!(file_0.metadata.symlink.is_none());
|
assert!(file_0.metadata.symlink.is_none());
|
||||||
} else {
|
} else {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@@ -803,7 +803,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
// Verify simlink
|
// Verify simlink
|
||||||
let file_1: &File = files.get(1).unwrap();
|
let file_1: &File = files.get(1).unwrap();
|
||||||
if file_1.name() == String::from("bar.txt") {
|
if file_1.name() == *"bar.txt" {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
file_1.metadata.symlink.as_ref().unwrap(),
|
file_1.metadata.symlink.as_ref().unwrap(),
|
||||||
&PathBuf::from(format!("{}/foo.txt", tmpdir.path().display()))
|
&PathBuf::from(format!("{}/foo.txt", tmpdir.path().display()))
|
||||||
|
|||||||
@@ -491,7 +491,7 @@ mod tests {
|
|||||||
// Verify client has updated parameters
|
// Verify client has updated parameters
|
||||||
assert_eq!(client.get_default_protocol(), FileTransferProtocol::Scp);
|
assert_eq!(client.get_default_protocol(), FileTransferProtocol::Scp);
|
||||||
assert_eq!(client.get_text_editor(), PathBuf::from("/usr/bin/vim"));
|
assert_eq!(client.get_text_editor(), PathBuf::from("/usr/bin/vim"));
|
||||||
let mut expected_key_path: PathBuf = key_path.clone();
|
let mut expected_key_path: PathBuf = key_path;
|
||||||
expected_key_path.push("pi@192.168.1.31.key");
|
expected_key_path.push("pi@192.168.1.31.key");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
client.get_ssh_key("pi@192.168.1.31").unwrap().unwrap(),
|
client.get_ssh_key("pi@192.168.1.31").unwrap().unwrap(),
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ mod tests {
|
|||||||
#[serial]
|
#[serial]
|
||||||
fn test_system_environment_get_bookmarks_paths() {
|
fn test_system_environment_get_bookmarks_paths() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
get_bookmarks_paths(&Path::new("/home/omar/.config/termscp/")),
|
get_bookmarks_paths(Path::new("/home/omar/.config/termscp/")),
|
||||||
PathBuf::from("/home/omar/.config/termscp/bookmarks.toml"),
|
PathBuf::from("/home/omar/.config/termscp/bookmarks.toml"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ mod tests {
|
|||||||
#[serial]
|
#[serial]
|
||||||
fn test_system_environment_get_config_paths() {
|
fn test_system_environment_get_config_paths() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
get_config_paths(&Path::new("/home/omar/.config/termscp/")),
|
get_config_paths(Path::new("/home/omar/.config/termscp/")),
|
||||||
(
|
(
|
||||||
PathBuf::from("/home/omar/.config/termscp/config.toml"),
|
PathBuf::from("/home/omar/.config/termscp/config.toml"),
|
||||||
PathBuf::from("/home/omar/.config/termscp/.ssh/")
|
PathBuf::from("/home/omar/.config/termscp/.ssh/")
|
||||||
@@ -147,7 +147,7 @@ mod tests {
|
|||||||
#[serial]
|
#[serial]
|
||||||
fn test_system_environment_get_log_paths() {
|
fn test_system_environment_get_log_paths() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
get_log_paths(&Path::new("/home/omar/.config/termscp/")),
|
get_log_paths(Path::new("/home/omar/.config/termscp/")),
|
||||||
PathBuf::from("/home/omar/.config/termscp/termscp.log"),
|
PathBuf::from("/home/omar/.config/termscp/termscp.log"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ mod tests {
|
|||||||
#[serial]
|
#[serial]
|
||||||
fn test_system_environment_get_theme_path() {
|
fn test_system_environment_get_theme_path() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
get_theme_path(&Path::new("/home/omar/.config/termscp/")),
|
get_theme_path(Path::new("/home/omar/.config/termscp/")),
|
||||||
PathBuf::from("/home/omar/.config/termscp/theme.toml"),
|
PathBuf::from("/home/omar/.config/termscp/theme.toml"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_system_keys_filestorage_make_dir() {
|
fn test_system_keys_filestorage_make_dir() {
|
||||||
let storage: FileStorage = FileStorage::new(&Path::new("/tmp/"));
|
let storage: FileStorage = FileStorage::new(Path::new("/tmp/"));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
storage.make_file_path("bookmarks").as_path(),
|
storage.make_file_path("bookmarks").as_path(),
|
||||||
Path::new("/tmp/.bookmarks.key")
|
Path::new("/tmp/.bookmarks.key")
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ pub mod keyringstorage;
|
|||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
/// defines the error type for the `KeyStorage`
|
/// defines the error type for the `KeyStorage`
|
||||||
#[derive(Debug, Error, PartialEq)]
|
#[derive(Debug, Error, PartialEq, Eq)]
|
||||||
pub enum KeyStorageError {
|
pub enum KeyStorageError {
|
||||||
#[cfg(feature = "with-keyring")]
|
#[cfg(feature = "with-keyring")]
|
||||||
#[error("Key has a bad syntax")]
|
#[error("Key has a bad syntax")]
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ mod tests {
|
|||||||
// Create ssh key storage
|
// Create ssh key storage
|
||||||
let storage: SshKeyStorage = SshKeyStorage::from(&client);
|
let storage: SshKeyStorage = SshKeyStorage::from(&client);
|
||||||
// Verify key exists
|
// Verify key exists
|
||||||
let mut exp_key_path: PathBuf = key_path.clone();
|
let mut exp_key_path: PathBuf = key_path;
|
||||||
exp_key_path.push("pi@192.168.1.31.key");
|
exp_key_path.push("pi@192.168.1.31.key");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*storage.resolve("192.168.1.31", "pi").unwrap(),
|
*storage.resolve("192.168.1.31", "pi").unwrap(),
|
||||||
|
|||||||
@@ -60,14 +60,14 @@ pub enum Id {
|
|||||||
WindowSizeError,
|
WindowSizeError,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, Eq, PartialEq)]
|
||||||
pub enum Msg {
|
pub enum Msg {
|
||||||
Form(FormMsg),
|
Form(FormMsg),
|
||||||
Ui(UiMsg),
|
Ui(UiMsg),
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum FormMsg {
|
pub enum FormMsg {
|
||||||
Connect,
|
Connect,
|
||||||
DeleteBookmark,
|
DeleteBookmark,
|
||||||
@@ -81,7 +81,7 @@ pub enum FormMsg {
|
|||||||
SaveBookmark,
|
SaveBookmark,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum UiMsg {
|
pub enum UiMsg {
|
||||||
AddressBlurDown,
|
AddressBlurDown,
|
||||||
AddressBlurUp,
|
AddressBlurUp,
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ impl FileTransferActivity {
|
|||||||
Ok(h) => {
|
Ok(h) => {
|
||||||
let hostname: String = h.as_os_str().to_string_lossy().to_string();
|
let hostname: String = h.as_os_str().to_string_lossy().to_string();
|
||||||
let tokens: Vec<&str> = hostname.split('.').collect();
|
let tokens: Vec<&str> = hostname.split('.').collect();
|
||||||
String::from(*tokens.get(0).unwrap_or(&"localhost"))
|
String::from(*tokens.first().unwrap_or(&"localhost"))
|
||||||
}
|
}
|
||||||
Err(_) => String::from("localhost"),
|
Err(_) => String::from("localhost"),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ impl FileTransferActivity {
|
|||||||
self.action_submit_local(entry);
|
self.action_submit_local(entry);
|
||||||
// Update file list if sync
|
// Update file list if sync
|
||||||
if self.browser.sync_browsing && self.browser.found().is_none() {
|
if self.browser.sync_browsing && self.browser.found().is_none() {
|
||||||
let _ = self.update_remote_filelist();
|
self.update_remote_filelist();
|
||||||
}
|
}
|
||||||
self.update_local_filelist();
|
self.update_local_filelist();
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ impl FileTransferActivity {
|
|||||||
self.action_submit_remote(entry);
|
self.action_submit_remote(entry);
|
||||||
// Update file list if sync
|
// Update file list if sync
|
||||||
if self.browser.sync_browsing && self.browser.found().is_none() {
|
if self.browser.sync_browsing && self.browser.found().is_none() {
|
||||||
let _ = self.update_local_filelist();
|
self.update_local_filelist();
|
||||||
}
|
}
|
||||||
self.update_remote_filelist();
|
self.update_remote_filelist();
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ impl FileTransferActivity {
|
|||||||
FileExplorerTab::Local => {
|
FileExplorerTab::Local => {
|
||||||
self.action_go_to_local_upper_dir();
|
self.action_go_to_local_upper_dir();
|
||||||
if self.browser.sync_browsing && self.browser.found().is_none() {
|
if self.browser.sync_browsing && self.browser.found().is_none() {
|
||||||
let _ = self.update_remote_filelist();
|
self.update_remote_filelist();
|
||||||
}
|
}
|
||||||
// Reload file list component
|
// Reload file list component
|
||||||
self.update_local_filelist()
|
self.update_local_filelist()
|
||||||
@@ -169,7 +169,7 @@ impl FileTransferActivity {
|
|||||||
FileExplorerTab::Remote => {
|
FileExplorerTab::Remote => {
|
||||||
self.action_go_to_remote_upper_dir();
|
self.action_go_to_remote_upper_dir();
|
||||||
if self.browser.sync_browsing && self.browser.found().is_none() {
|
if self.browser.sync_browsing && self.browser.found().is_none() {
|
||||||
let _ = self.update_local_filelist();
|
self.update_local_filelist();
|
||||||
}
|
}
|
||||||
// Reload file list component
|
// Reload file list component
|
||||||
self.update_remote_filelist()
|
self.update_remote_filelist()
|
||||||
@@ -182,7 +182,7 @@ impl FileTransferActivity {
|
|||||||
FileExplorerTab::Local => {
|
FileExplorerTab::Local => {
|
||||||
self.action_go_to_previous_local_dir();
|
self.action_go_to_previous_local_dir();
|
||||||
if self.browser.sync_browsing && self.browser.found().is_none() {
|
if self.browser.sync_browsing && self.browser.found().is_none() {
|
||||||
let _ = self.update_remote_filelist();
|
self.update_remote_filelist();
|
||||||
}
|
}
|
||||||
// Reload file list component
|
// Reload file list component
|
||||||
self.update_local_filelist()
|
self.update_local_filelist()
|
||||||
@@ -190,7 +190,7 @@ impl FileTransferActivity {
|
|||||||
FileExplorerTab::Remote => {
|
FileExplorerTab::Remote => {
|
||||||
self.action_go_to_previous_remote_dir();
|
self.action_go_to_previous_remote_dir();
|
||||||
if self.browser.sync_browsing && self.browser.found().is_none() {
|
if self.browser.sync_browsing && self.browser.found().is_none() {
|
||||||
let _ = self.update_local_filelist();
|
self.update_local_filelist();
|
||||||
}
|
}
|
||||||
// Reload file list component
|
// Reload file list component
|
||||||
self.update_remote_filelist()
|
self.update_remote_filelist()
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ impl FileTransferActivity {
|
|||||||
self.refresh_local_status_bar();
|
self.refresh_local_status_bar();
|
||||||
self.refresh_remote_status_bar();
|
self.refresh_remote_status_bar();
|
||||||
// Update components
|
// Update components
|
||||||
let _ = self.update_local_filelist();
|
self.update_local_filelist();
|
||||||
let _ = self.update_remote_filelist();
|
self.update_remote_filelist();
|
||||||
// Global listener
|
// Global listener
|
||||||
self.mount_global_listener();
|
self.mount_global_listener();
|
||||||
// Give focus to local explorer
|
// Give focus to local explorer
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ impl NotificationsThreshold {
|
|||||||
parse_bytesize(bytes).is_some()
|
parse_bytesize(bytes).is_some()
|
||||||
}
|
}
|
||||||
fn char_valid(_input: &str, incoming: char) -> bool {
|
fn char_valid(_input: &str, incoming: char) -> bool {
|
||||||
incoming.is_digit(10) || ['B', 'K', 'M', 'G', 'T', 'P'].contains(&incoming)
|
incoming.is_ascii_digit() || ['B', 'K', 'M', 'G', 'T', 'P'].contains(&incoming)
|
||||||
}
|
}
|
||||||
Self {
|
Self {
|
||||||
component: Input::default()
|
component: Input::default()
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ pub enum IdTheme {
|
|||||||
TransferTitle2,
|
TransferTitle2,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum Msg {
|
pub enum Msg {
|
||||||
Common(CommonMsg),
|
Common(CommonMsg),
|
||||||
Config(ConfigMsg),
|
Config(ConfigMsg),
|
||||||
@@ -108,7 +108,7 @@ pub enum Msg {
|
|||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum CommonMsg {
|
pub enum CommonMsg {
|
||||||
ChangeLayout,
|
ChangeLayout,
|
||||||
CloseErrorPopup,
|
CloseErrorPopup,
|
||||||
@@ -125,7 +125,7 @@ pub enum CommonMsg {
|
|||||||
WindowResized,
|
WindowResized,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum ConfigMsg {
|
pub enum ConfigMsg {
|
||||||
CheckUpdatesBlurDown,
|
CheckUpdatesBlurDown,
|
||||||
CheckUpdatesBlurUp,
|
CheckUpdatesBlurUp,
|
||||||
@@ -152,7 +152,7 @@ pub enum ConfigMsg {
|
|||||||
TextEditorBlurUp,
|
TextEditorBlurUp,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum SshMsg {
|
pub enum SshMsg {
|
||||||
CloseDelSshKeyPopup,
|
CloseDelSshKeyPopup,
|
||||||
CloseNewSshKeyPopup,
|
CloseNewSshKeyPopup,
|
||||||
@@ -165,7 +165,7 @@ pub enum SshMsg {
|
|||||||
SshUsernameBlur,
|
SshUsernameBlur,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum ThemeMsg {
|
pub enum ThemeMsg {
|
||||||
AuthAddressBlurDown,
|
AuthAddressBlurDown,
|
||||||
AuthAddressBlurUp,
|
AuthAddressBlurUp,
|
||||||
@@ -230,7 +230,7 @@ const STORE_CONFIG_CHANGED: &str = "SETUP_CONFIG_CHANGED";
|
|||||||
/// ### ViewLayout
|
/// ### ViewLayout
|
||||||
///
|
///
|
||||||
/// Current view layout
|
/// Current view layout
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq, Eq)]
|
||||||
pub enum ViewLayout {
|
pub enum ViewLayout {
|
||||||
SetupForm,
|
SetupForm,
|
||||||
SshKeys,
|
SshKeys,
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ mod tests {
|
|||||||
fn test_utils_crypto_aes128() {
|
fn test_utils_crypto_aes128() {
|
||||||
let key: &str = "MYSUPERSECRETKEY";
|
let key: &str = "MYSUPERSECRETKEY";
|
||||||
let input: &str = "Hello world!";
|
let input: &str = "Hello world!";
|
||||||
let secret: String = aes128_b64_crypt(&key, input);
|
let secret: String = aes128_b64_crypt(key, input);
|
||||||
assert_eq!(secret.as_str(), "z4Z6LpcpYqBW4+bkIok+5A==");
|
assert_eq!(secret.as_str(), "z4Z6LpcpYqBW4+bkIok+5A==");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
aes128_b64_decrypt(key, secret.as_str())
|
aes128_b64_decrypt(key, secret.as_str())
|
||||||
|
|||||||
+3
-3
@@ -300,7 +300,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_utils_fmt_time() {
|
fn test_utils_fmt_time() {
|
||||||
let system_time: SystemTime = SystemTime::from(SystemTime::UNIX_EPOCH);
|
let system_time: SystemTime = SystemTime::UNIX_EPOCH;
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
fmt_time(system_time, "%Y-%m-%d"),
|
fmt_time(system_time, "%Y-%m-%d"),
|
||||||
String::from("1970-01-01")
|
String::from("1970-01-01")
|
||||||
@@ -326,12 +326,12 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
#[cfg(target_family = "unix")]
|
#[cfg(target_family = "unix")]
|
||||||
fn test_utils_fmt_path_elide() {
|
fn test_utils_fmt_path_elide() {
|
||||||
let p: &Path = &Path::new("/develop/pippo");
|
let p: &Path = Path::new("/develop/pippo");
|
||||||
// Under max size
|
// Under max size
|
||||||
assert_eq!(fmt_path_elide(p, 16), String::from("/develop/pippo"));
|
assert_eq!(fmt_path_elide(p, 16), String::from("/develop/pippo"));
|
||||||
// Above max size, only one ancestor
|
// Above max size, only one ancestor
|
||||||
assert_eq!(fmt_path_elide(p, 8), String::from("/develop/pippo"));
|
assert_eq!(fmt_path_elide(p, 8), String::from("/develop/pippo"));
|
||||||
let p: &Path = &Path::new("/develop/pippo/foo/bar");
|
let p: &Path = Path::new("/develop/pippo/foo/bar");
|
||||||
assert_eq!(fmt_path_elide(p, 16), String::from("/develop/…/foo/bar"));
|
assert_eq!(fmt_path_elide(p, 16), String::from("/develop/…/foo/bar"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -94,11 +94,11 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn absolutize_path() {
|
fn absolutize_path() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
absolutize(&Path::new("/home/omar"), &Path::new("readme.txt")).as_path(),
|
absolutize(Path::new("/home/omar"), Path::new("readme.txt")).as_path(),
|
||||||
Path::new("/home/omar/readme.txt")
|
Path::new("/home/omar/readme.txt")
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
absolutize(&Path::new("/home/omar"), &Path::new("/tmp/readme.txt")).as_path(),
|
absolutize(Path::new("/home/omar"), Path::new("/tmp/readme.txt")).as_path(),
|
||||||
Path::new("/tmp/readme.txt")
|
Path::new("/tmp/readme.txt")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user