summaryrefslogtreecommitdiffstats
path: root/src/key_command/impl_from_str.rs
diff options
context:
space:
mode:
authorUros <59397844+uros-5@users.noreply.github.com>2023-08-12 14:53:45 +0200
committerGitHub <noreply@github.com>2023-08-12 08:53:45 -0400
commit98a72a030e12a0af020607ca57ffbdc7eeabdbc0 (patch)
tree34b117f469affa15ba88a639f56d0c06409536ea /src/key_command/impl_from_str.rs
parent0eec61eb82d10b8b9f76c8b5c9e2a0fae0514a1e (diff)
added all_selected field in CopyFilePath (#391)
* added all_selected field in CopyFilePath * copy_filepath now handle both cases
Diffstat (limited to 'src/key_command/impl_from_str.rs')
-rw-r--r--src/key_command/impl_from_str.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/key_command/impl_from_str.rs b/src/key_command/impl_from_str.rs
index be0ce01..b00008b 100644
--- a/src/key_command/impl_from_str.rs
+++ b/src/key_command/impl_from_str.rs
@@ -74,7 +74,7 @@ impl std::str::FromStr for Command {
CMD_COPY_FILENAME_WITHOUT_EXTENSION,
Self::CopyFileNameWithoutExtension
);
- simple_command_conversion_case!(command, CMD_COPY_FILEPATH, Self::CopyFilePath);
+ // simple_command_conversion_case!(command, CMD_COPY_FILEPATH, Self::CopyFilePath);
simple_command_conversion_case!(command, CMD_COPY_DIRECTORY_PATH, Self::CopyDirPath);
simple_command_conversion_case!(command, CMD_OPEN_FILE, Self::OpenFile);
@@ -230,6 +230,21 @@ impl std::str::FromStr for Command {
}
}
Ok(Self::SymlinkFiles { relative })
+ } else if command == CMD_COPY_FILEPATH {
+ let mut all_selected = false;
+ for arg in arg.split_whitespace() {
+ match arg {
+ "--all-selected=true" => all_selected = true,
+ "" => all_selected = false,
+ _ => {
+ return Err(JoshutoError::new(
+ JoshutoErrorKind::UnrecognizedArgument,
+ format!("{}: unknown option '{}'", command, arg),
+ ));
+ }
+ }
+ }
+ Ok(Self::CopyFilePath { all_selected })
} else if command == CMD_PASTE_FILES {
let mut options = FileOperationOptions::default();
for arg in arg.split_whitespace() {