Added file_fmt to configuration

This commit is contained in:
veeso 2021-01-23 16:00:41 +01:00
parent da0d5231bf
commit e92370bd05
2 changed files with 7 additions and 0 deletions

View file

@ -56,6 +56,7 @@ pub struct UserInterfaceConfig {
pub default_protocol: String, pub default_protocol: String,
pub show_hidden_files: bool, pub show_hidden_files: bool,
pub group_dirs: Option<String>, pub group_dirs: Option<String>,
pub file_fmt: Option<String>,
} }
#[derive(Deserialize, Serialize, std::fmt::Debug)] #[derive(Deserialize, Serialize, std::fmt::Debug)]
@ -85,6 +86,7 @@ impl Default for UserInterfaceConfig {
default_protocol: FileTransferProtocol::Sftp.to_string(), default_protocol: FileTransferProtocol::Sftp.to_string(),
show_hidden_files: false, show_hidden_files: false,
group_dirs: None, group_dirs: None,
file_fmt: None,
} }
} }
} }
@ -171,6 +173,7 @@ mod tests {
text_editor: PathBuf::from("nano"), text_editor: PathBuf::from("nano"),
show_hidden_files: true, show_hidden_files: true,
group_dirs: Some(String::from("first")), group_dirs: Some(String::from("first")),
file_fmt: Some(String::from("{NAME}")),
}; };
let cfg: UserConfig = UserConfig { let cfg: UserConfig = UserConfig {
user_interface: ui, user_interface: ui,
@ -187,6 +190,7 @@ mod tests {
assert_eq!(cfg.user_interface.text_editor, PathBuf::from("nano")); assert_eq!(cfg.user_interface.text_editor, PathBuf::from("nano"));
assert_eq!(cfg.user_interface.show_hidden_files, true); 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.group_dirs, Some(String::from("first")));
assert_eq!(cfg.user_interface.file_fmt, Some(String::from("{NAME}")));
} }
#[test] #[test]

View file

@ -108,6 +108,7 @@ mod tests {
assert_eq!(cfg.user_interface.text_editor, PathBuf::from("vim")); assert_eq!(cfg.user_interface.text_editor, PathBuf::from("vim"));
assert_eq!(cfg.user_interface.show_hidden_files, true); 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.group_dirs, Some(String::from("last")));
assert_eq!(cfg.user_interface.file_fmt, Some(String::from("{NAME} {PEX}")));
// Verify keys // Verify keys
assert_eq!( assert_eq!(
*cfg.remote *cfg.remote
@ -143,6 +144,7 @@ mod tests {
assert_eq!(cfg.user_interface.text_editor, PathBuf::from("vim")); assert_eq!(cfg.user_interface.text_editor, PathBuf::from("vim"));
assert_eq!(cfg.user_interface.show_hidden_files, true); assert_eq!(cfg.user_interface.show_hidden_files, true);
assert_eq!(cfg.user_interface.group_dirs, None); assert_eq!(cfg.user_interface.group_dirs, None);
assert_eq!(cfg.user_interface.file_fmt, None);
// Verify keys // Verify keys
assert_eq!( assert_eq!(
*cfg.remote *cfg.remote
@ -199,6 +201,7 @@ mod tests {
text_editor = "vim" text_editor = "vim"
show_hidden_files = true show_hidden_files = true
group_dirs = "last" group_dirs = "last"
file_fmt = "{NAME} {PEX}"
[remote.ssh_keys] [remote.ssh_keys]
"192.168.1.31" = "/home/omar/.ssh/raspberry.key" "192.168.1.31" = "/home/omar/.ssh/raspberry.key"