kamiyaa / joshuto

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

custom_commands + fallback for the older configurations #446

Closed Dzordzu closed 8 months ago

Dzordzu commented 9 months ago
  1. Added custom_commands
  2. Implemented custom_search
  3. Implemented custom_serach_interactive
  4. Added fallback for the command in the keymaps

Synchronized with the upstream version of the #339. Adds a fallback for the older keymap command parameter. It is translated into commands with single value. command takes precedence over commands

Also see #338 for reference

Dzordzu commented 9 months ago

@kamiyaa I've done some sync. Let me know you've got any issues/suggestions to apply :)

Dzordzu commented 8 months ago

@kamiyaa Just want to ping you. Before the codebase changes again ;)

superiums commented 8 months ago

no custom commands need. all shell command was custom commands. the only thing need to concern was pipe_out and pipe_in

  1. dir to cd.
  2. file/files to select.
superiums commented 8 months ago

no custom commands need. all shell command was custom commands. the only thing need to concern was pipe_out and pipe_in

  1. dir to cd.
  2. file/files to select.

maybe only need to read it from standerd output.

Dzordzu commented 8 months ago

all shell command was custom commands

Not exactly. The purpose of the custom_commands is to provide some simple flexibility inside joshuto built-in commands. It's a quick patch, that does not require massive code changes and refactoring.

Honestly, I do not understand rest of your message.

superiums commented 8 months ago

about fall back to old command, maybe there's a third way: use just old command, and add a separator such as && or ; to support multi command.

superiums commented 8 months ago

all shell command was custom commands

Not exactly. The purpose of the custom_commands is to provide some simple flexibility inside joshuto built-in commands. It's a quick patch, that does not require massive code changes and refactoring.

Honestly, I do not understand rest of your message.

then, the define of custom command was the first thing. i guess the custom_command means custom search or sth like that. if there is a way to make more flexiability of inner commands, that's very good.

i mean the search_fzf z zi or such an thing, may be able to be more flexable. now there's fd replaced find, image years later, sth comes out to replace z fzf, our joshuto still support it without any coding update? or now, i wonder rg to be support in joshuto? or now, i have an custom script to search out my files. how could i integrate it to joshuto ?

all these things can be done just with a litte restructure : just receive piped back result after executed shell command. that's all.

for example: rg/fzf/z, they just do their own job. joshuto should not hard code them, but trait them as a common shell command. and receive the result after execute.

this will be more flexable to all custom needs.

superiums commented 8 months ago

in ranger, shell -w wait user to have a glance to the command result. maybe we could: shell -p to pipe the result back to joshuto. shell to run the command background and do nothing. shell -r to run the command background and reload current dir in joshuto .

kamiyaa commented 8 months ago

LGTM! Thanks!