From 098332fc0548b95c1559e270d04126d3f52be6ac Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Sun, 17 Sep 2017 19:36:37 +0300 Subject: [PATCH] add user defined 'put' commands to documentation --- doc.go | 22 ++++++++++++++++++++++ docstring.go | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/doc.go b/doc.go index 71b2898b..cc62976e 100644 --- a/doc.go +++ b/doc.go @@ -337,6 +337,28 @@ followed by 'put'. These traditional names (e.g. 'yank', 'delete', and 'put') are picked instead of the other common convention (e.g. copy and cut) to resemble the default keybinds for these operations. +You can customize these operations by defining a 'put' command. This is a +special command that is called when it is defined instead of the builtin +implementation. The default behavior is similar to the following command: + + cmd put ${{ + load=$(lf -remote 'load') + mode=$(echo "$load" | sed -n '1p') + list=$(echo "$load" | sed '1d') + if [ $mode = 'copy' ]; then + cp -r $list . + elif [ $mode = 'move' ]; then + mv $list . + fi + }} + +Some of the useful things you can do is to add some backup or overwrite options +to 'cp' and 'mv' operations (e.g. '--backup' or '-n'), change the command type +to asynchronous while also adding a remote 'renew' call at the end to update +the client afterwards, or use 'rsync' command with progress bar option for +copying and feed the progress to the client periodically with remote 'echo' +calls. + By default, lf does not provide an actual file deletion command to protect new users. You can define such a command and optionally assign a key if you like. An example command to move selected files to a trash folder and remove files diff --git a/docstring.go b/docstring.go index d86b8705..e6c5eae7 100644 --- a/docstring.go +++ b/docstring.go @@ -351,6 +351,28 @@ followed by 'put'. These traditional names (e.g. 'yank', 'delete', and 'put') are picked instead of the other common convention (e.g. copy and cut) to resemble the default keybinds for these operations. +You can customize these operations by defining a 'put' command. This is a +special command that is called when it is defined instead of the builtin +implementation. The default behavior is similar to the following command: + + cmd put ${{ + load=$(lf -remote 'load') + mode=$(echo "$load" | sed -n '1p') + list=$(echo "$load" | sed '1d') + if [ $mode = 'copy' ]; then + cp -r $list . + elif [ $mode = 'move' ]; then + mv $list . + fi + }} + +Some of the useful things you can do is to add some backup or overwrite +options to 'cp' and 'mv' operations (e.g. '--backup' or '-n'), change the +command type to asynchronous while also adding a remote 'renew' call at the +end to update the client afterwards, or use 'rsync' command with progress +bar option for copying and feed the progress to the client periodically with +remote 'echo' calls. + By default, lf does not provide an actual file deletion command to protect new users. You can define such a command and optionally assign a key if you like. An example command to move selected files to a trash folder and remove