From 7ee7a761ec62a065fcc2bde9d98b587d069b364a Mon Sep 17 00:00:00 2001 From: Jeff Zhao Date: Mon, 1 Aug 2022 12:34:53 -0400 Subject: add `symlink_files` command --- src/commands/delete_files.rs | 1 - src/commands/file_ops.rs | 13 +++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src/commands') diff --git a/src/commands/delete_files.rs b/src/commands/delete_files.rs index 272fd1a..987c45e 100644 --- a/src/commands/delete_files.rs +++ b/src/commands/delete_files.rs @@ -53,7 +53,6 @@ fn delete_files( let options = FileOperationOptions { overwrite: false, skip_exist: false, - symlink: false, permanently: !context.config_ref().use_trash, }; diff --git a/src/commands/file_ops.rs b/src/commands/file_ops.rs index ce9b787..c50129b 100644 --- a/src/commands/file_ops.rs +++ b/src/commands/file_ops.rs @@ -31,6 +31,19 @@ pub fn copy(context: &mut AppContext) -> JoshutoResult { Ok(()) } +pub fn link(context: &mut AppContext) -> JoshutoResult { + if let Some(list) = context.tab_context_ref().curr_tab_ref().curr_list_ref() { + let selected = list.get_selected_paths(); + + let mut local_state = LocalStateContext::new(); + local_state.set_paths(selected.into_iter()); + local_state.set_file_op(FileOperation::Symlink); + + context.set_local_state(local_state); + } + Ok(()) +} + pub fn paste(context: &mut AppContext, options: FileOperationOptions) -> JoshutoResult { match context.take_local_state() { Some(state) if !state.paths.is_empty() => { -- cgit v1.2.3