summaryrefslogtreecommitdiffstats
path: root/src/key_command/impl_appexecute.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/key_command/impl_appexecute.rs')
-rw-r--r--src/key_command/impl_appexecute.rs75
1 files changed, 45 insertions, 30 deletions
diff --git a/src/key_command/impl_appexecute.rs b/src/key_command/impl_appexecute.rs
index 982825c..0dc9a9d 100644
--- a/src/key_command/impl_appexecute.rs
+++ b/src/key_command/impl_appexecute.rs
@@ -19,8 +19,8 @@ impl AppExecute for Command {
Self::BulkRename => bulk_rename::bulk_rename(context, backend),
- Self::ChangeDirectory(p) => {
- change_directory::change_directory(context, p.as_path())?;
+ Self::ChangeDirectory { path } => {
+ change_directory::change_directory(context, path.as_path())?;
Ok(())
}
Self::ParentDirectory => change_directory::parent_directory(context),
@@ -28,9 +28,13 @@ impl AppExecute for Command {
Self::NewTab => tab_ops::new_tab(context),
Self::CloseTab => tab_ops::close_tab(context),
- Self::CommandLine(p, s) => {
- command_line::read_and_execute(context, backend, keymap_t, p.as_str(), s.as_str())
- }
+ Self::CommandLine { prefix, suffix } => command_line::read_and_execute(
+ context,
+ backend,
+ keymap_t,
+ prefix.as_str(),
+ suffix.as_str(),
+ ),
Self::CutFiles => file_ops::cut(context),
Self::CopyFiles => file_ops::copy(context),
Self::CopyFileName => file_ops::copy_filename(context),
@@ -39,8 +43,9 @@ impl AppExecute for Command {
}
Self::CopyFilePath => file_ops::copy_filepath(context),
Self::CopyDirPath => file_ops::copy_dirpath(context),
- Self::SymlinkFiles => file_ops::link(context),
- Self::PasteFiles(options) => file_ops::paste(context, *options),
+ Self::SymlinkFiles { relative: true } => file_ops::symlink_relative(context),
+ Self::SymlinkFiles { relative: false } => file_ops::symlink_absolute(context),
+ Self::PasteFiles { options } => file_ops::paste(context, *options),
Self::DeleteFiles { background: false } => {
delete_files::delete_selected_files(context, backend)
@@ -49,8 +54,8 @@ impl AppExecute for Command {
delete_files::delete_selected_files_background(context, backend)
}
- Self::CursorMoveUp(u) => cursor_move::up(context, *u),
- Self::CursorMoveDown(u) => cursor_move::down(context, *u),
+ Self::CursorMoveUp { offset } => cursor_move::up(context, *offset),
+ Self::CursorMoveDown { offset } => cursor_move::down(context, *offset),
Self::CursorMoveHome => cursor_move::home(context),
Self::CursorMoveEnd => cursor_move::end(context),
Self::CursorMovePageUp(p) => cursor_move::page_up(context, backend, *p),
@@ -60,60 +65,70 @@ impl AppExecute for Command {
Self::CursorMovePageMiddle => cursor_move::page_middle(context, backend),
Self::CursorMovePageEnd => cursor_move::page_end(context, backend),
- Self::ParentCursorMoveUp(u) => parent_cursor_move::parent_up(context, *u),
- Self::ParentCursorMoveDown(u) => parent_cursor_move::parent_down(context, *u),
+ Self::ParentCursorMoveUp { offset } => parent_cursor_move::parent_up(context, *offset),
+ Self::ParentCursorMoveDown { offset } => {
+ parent_cursor_move::parent_down(context, *offset)
+ }
- Self::PreviewCursorMoveUp(u) => preview_cursor_move::preview_up(context, *u),
- Self::PreviewCursorMoveDown(u) => preview_cursor_move::preview_down(context, *u),
+ Self::PreviewCursorMoveUp { offset } => {
+ preview_cursor_move::preview_up(context, *offset)
+ }
+ Self::PreviewCursorMoveDown { offset } => {
+ preview_cursor_move::preview_down(context, *offset)
+ }
- Self::NewDirectory(p) => new_directory::new_directory(context, p.as_path()),
+ Self::NewDirectory { path } => new_directory::new_directory(context, path.as_path()),
Self::OpenFile => open_file::open(context, backend),
- Self::OpenFileWith(None) => open_file::open_with_interactive(context, backend),
- Self::OpenFileWith(Some(i)) => open_file::open_with_index(context, backend, *i),
+ Self::OpenFileWith { index: None } => {
+ open_file::open_with_interactive(context, backend)
+ }
+ Self::OpenFileWith { index: Some(i) } => {
+ open_file::open_with_index(context, backend, *i)
+ }
Self::Quit(action) => quit::quit_with_action(context, *action),
Self::ReloadDirList => reload::reload_dirlist(context),
- Self::RenameFile(p) => rename_file::rename_file(context, p.as_path()),
+ Self::RenameFile { new_name } => rename_file::rename_file(context, new_name.as_path()),
Self::RenameFileAppend => rename_file::rename_file_append(context, backend, keymap_t),
Self::RenameFilePrepend => rename_file::rename_file_prepend(context, backend, keymap_t),
- Self::TouchFile(arg) => touch_file::touch_file(context, arg.as_str()),
- Self::SearchGlob(pattern) => search_glob::search_glob(context, pattern.as_str()),
- Self::SearchString(pattern) => {
+ Self::TouchFile { file_name } => touch_file::touch_file(context, file_name),
+ Self::SearchGlob { pattern } => search_glob::search_glob(context, pattern.as_str()),
+ Self::SearchString { pattern } => {
search_string::search_string(context, pattern.as_str(), false);
Ok(())
}
// We call `interactive_execute` on each key press, so even before Enter is pressed the
// cursor will be one the selected word. And as `interactive_execute` for
// `SearchIncremental` always starts from index 0, this operation will be a no-op
- Self::SearchIncremental(_) => Ok(()),
+ Self::SearchIncremental { .. } => Ok(()),
Self::SearchNext => search::search_next(context),
Self::SearchPrev => search::search_prev(context),
- Self::SelectFiles(pattern, options) => {
+ Self::SelectFiles { pattern, options } => {
select::select_files(context, pattern.as_str(), options)
}
Self::SetMode => set_mode::set_mode(context, backend),
Self::ShowTasks => show_tasks::show_tasks(context, backend, keymap_t),
Self::Sort(t) => sort::set_sort(context, *t),
Self::SortReverse => sort::toggle_reverse(context),
- Self::SubProcess(v, spawn) => {
- sub_process::sub_process(context, backend, v.as_slice(), *spawn)
+ Self::SubProcess { words, spawn } => {
+ sub_process::sub_process(context, backend, words.as_slice(), *spawn)
}
Self::SwitchLineNums(d) => line_nums::switch_line_numbering(context, *d),
- Self::Flat(depth) => flat::flatten(*depth, context),
- Self::NumberedCommand(c) => {
- numbered_command::numbered_command(*c, context, backend, keymap_t)
+ Self::Flat { depth } => flat::flatten(context, *depth),
+ Self::NumberedCommand { initial } => {
+ numbered_command::numbered_command(context, backend, keymap_t, *initial)
}
Self::ToggleHiddenFiles => show_hidden::toggle_hidden(context),
- Self::TabSwitch(i) => {
- tab_ops::tab_switch(*i, context)?;
+ Self::TabSwitch { offset } => {
+ tab_ops::tab_switch(context, *offset)?;
Ok(())
}
- Self::TabSwitchIndex(i) => tab_ops::tab_switch_index(*i as usize, context),
+ Self::TabSwitchIndex { index } => tab_ops::tab_switch_index(context, *index),
Self::Help => show_help::help_loop(context, backend, keymap_t),
Self::SearchFzf => search_fzf::search_fzf(context, backend),