-
Notifications
You must be signed in to change notification settings - Fork 354
Open
Labels
Description
#2145 got me thinking that it would be quite nice if there was a simpler way to send commands to the current (in the sense of $id) lf instance.
A typical example from https://github.com/gokcehan/lf/wiki/Integrations illustrates this:
cmd zi ${{
result="$(zoxide query -i | sed 's/\\/\\\\/g;s/"/\\"/g')"
lf -remote "send $id cd \"$result\""
}}
The need for manually quoting the result is quite cumbersome.
I'd like to be able to instead write this as:
cmd zi ${{
result=$(zoxide query -i)
lf -local-send cd "$result"
}}
So, my proposal is to introduce new command-line options as follows:
lf -local-send COMMAND ARGS...shall be equivalent tolf -remote "send $id COMMAND ARGS...", but taking care of the quoting.lf -local-query TYPEshall be similarly equivalent tolf -remote "query $id TYPE".
Note that these commands would require the id environment variable to be set.
Further options and variations that may be considered:
- It may then be reasonable to rename the
idenvironment variable to something more unique, e.g.lf_id(with a period of backward compatibility). Once there is less need to type it out, it's fine if it's a few characters longer. - Does
queryreally need to be its own special thing, or could that just be a built-in command? - I'm combining two ideas here – not needing to spell out
$idand taking care of quoting – but they are kind of independent. Could do only one or the other.
og900aero