From e92370bd05e335938ac5a55c18c50a22c9c4a5b8 Mon Sep 17 00:00:00 2001 From: veeso Date: Sat, 23 Jan 2021 16:00:41 +0100 Subject: [PATCH] Added `file_fmt` to configuration --- src/config/mod.rs | 4 ++++ src/config/serializer.rs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/config/mod.rs b/src/config/mod.rs index 05f23a8..2225d2a 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -56,6 +56,7 @@ pub struct UserInterfaceConfig { pub default_protocol: String, pub show_hidden_files: bool, pub group_dirs: Option, + pub file_fmt: Option, } #[derive(Deserialize, Serialize, std::fmt::Debug)] @@ -85,6 +86,7 @@ impl Default for UserInterfaceConfig { default_protocol: FileTransferProtocol::Sftp.to_string(), show_hidden_files: false, group_dirs: None, + file_fmt: None, } } } @@ -171,6 +173,7 @@ mod tests { text_editor: PathBuf::from("nano"), show_hidden_files: true, group_dirs: Some(String::from("first")), + file_fmt: Some(String::from("{NAME}")), }; let cfg: UserConfig = UserConfig { user_interface: ui, @@ -187,6 +190,7 @@ mod tests { assert_eq!(cfg.user_interface.text_editor, PathBuf::from("nano")); assert_eq!(cfg.user_interface.show_hidden_files, true); assert_eq!(cfg.user_interface.group_dirs, Some(String::from("first"))); + assert_eq!(cfg.user_interface.file_fmt, Some(String::from("{NAME}"))); } #[test] diff --git a/src/config/serializer.rs b/src/config/serializer.rs index 89334d1..544b594 100644 --- a/src/config/serializer.rs +++ b/src/config/serializer.rs @@ -108,6 +108,7 @@ mod tests { assert_eq!(cfg.user_interface.text_editor, PathBuf::from("vim")); assert_eq!(cfg.user_interface.show_hidden_files, true); assert_eq!(cfg.user_interface.group_dirs, Some(String::from("last"))); + assert_eq!(cfg.user_interface.file_fmt, Some(String::from("{NAME} {PEX}"))); // Verify keys assert_eq!( *cfg.remote @@ -143,6 +144,7 @@ mod tests { assert_eq!(cfg.user_interface.text_editor, PathBuf::from("vim")); assert_eq!(cfg.user_interface.show_hidden_files, true); assert_eq!(cfg.user_interface.group_dirs, None); + assert_eq!(cfg.user_interface.file_fmt, None); // Verify keys assert_eq!( *cfg.remote @@ -199,6 +201,7 @@ mod tests { text_editor = "vim" show_hidden_files = true group_dirs = "last" + file_fmt = "{NAME} {PEX}" [remote.ssh_keys] "192.168.1.31" = "/home/omar/.ssh/raspberry.key"