kamiyaa / joshuto

ranger-like terminal file manager written in Rust
https://crates.io/crates/joshuto
GNU Lesser General Public License v3.0
3.37k stars 148 forks source link

[Feature] multiple commands in keymap? post-command hooks? something like that #415

Closed Beethoven-n closed 10 months ago

Beethoven-n commented 11 months ago

i've had the idea to add mounting volumes to my config, but i wanna try and do it a bit fancy.

# mount various things
{ keys = [ "M", "m" ],      command = ":shell sudo mount ", description = "Mount local volume" },
{ keys = [ "M", "m" ],      command = ":shell gio mount ",  description = "Mount remote volume" },

once i'm done with the command in command, i want to do :new_tab to the directory that i just mounted. this would be especially handy with gio mount, because i'd have to cd to a directory i can't specify, and would have to find with a script.

could i get some way to do multiple commands in a row? or a post-command hook? unsure how best to implement that

DLFW commented 11 months ago

Agree. I have similar use-cases. I proposed “command-chaining” in https://github.com/kamiyaa/joshuto/issues/241#issuecomment-1546851335 with the enhancement that a subsequent commands can use stdout and the return-code of a former shell command as variables. That would allow for a lot of useful things, like open a new tab in a directory that is returned by script.

I would like to pick that up but life keeps me surprisingly busy the last months.

kamiyaa commented 11 months ago

https://github.com/kamiyaa/joshuto/issues/241#issuecomment-1694921960

kamiyaa commented 11 months ago

Added in 31beaabe6b2cf4119aacae6c1722cdc1e5ba2f5b

Let me know how it is. It breaks existing keymap.toml configs

Beethoven-n commented 10 months ago

command chaining works just fine afaik. gonna close