diff options
author | Jeff Zhao <jeff.no.zhao@gmail.com> | 2022-08-01 12:34:53 -0400 |
---|---|---|
committer | Jeff Zhao <jeff.no.zhao@gmail.com> | 2022-08-01 12:39:14 -0400 |
commit | 7ee7a761ec62a065fcc2bde9d98b587d069b364a (patch) | |
tree | 2ae12dd9f1e8ea089d2972f41a8f5e0393383675 /src/commands | |
parent | ee0dec521b73a4328660969c3be8454dc0bf73e8 (diff) |
add `symlink_files` command
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/delete_files.rs | 1 | ||||
-rw-r--r-- | src/commands/file_ops.rs | 13 |
2 files changed, 13 insertions, 1 deletions
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() => { |