kamiyaa / joshuto

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

Added custom_commands and custom_search #339

Closed Dzordzu closed 11 months ago

Dzordzu commented 1 year ago

Implemented #338

Dzordzu commented 1 year ago

Demo: joshuto_demo

Dzordzu commented 1 year ago

@kamiyaa can you look at it?

kamiyaa commented 1 year ago

@kamiyaa can you look at it?

Yep! Sorry, I've just been busy :x

kamiyaa commented 1 year ago

Looks good so far.

Is there a reason for putting it inside joshuto.toml? I think it would make more sense to keep inside keymap.toml But on the other hand, that might make keymap.toml more complicated than it needs to be

Also, if you could add documentation for the new commands inside docs/ either in this PR, or a followup PR, that would be great!

Dzordzu commented 1 year ago

Is there a reason for putting it inside joshuto.toml

Yep. It may be later used as the simple plugin system (not only for commands, but for example for another window)

I think it would make more sense to keep inside keymap.toml

I also thought about it, but it is not a keymap, but a more general component

But on the other hand, that might make keymap.toml more complicated than it needs to be

Yep

Also, if you could add documentation for the new commands inside docs/

Oh. I forgot to include it! I will create a commit with docs in the following days :)

xfzv commented 1 year ago

Would this allow to chain "mixed" (shell + built-in joshuto) commands by any chance?

Use case:

I have the following in keymap.toml:

[default_view]

keymap = [
{ keys = ["*"], command = "shell /home/xfzv/.config/joshuto/toggle_executable.sh %s" },
]

toggle_executable.sh:

#! /usr/bin/env bash

if [[ -x "$1" ]]; then
    chmod -x "$1"
else
    chmod +x "$1"
fi

Works fine, but I have to run :reload_dirlist manually after pressing * so that joshuto reflects the permission change.

I wish I could use something like this for example:

[default_view]

keymap = [
{ keys = ["*"], command = "shell /home/xfzv/.config/joshuto/toggle_executable.sh %s" ; :reload_dirlist },
]
xfzv commented 1 year ago

Implemented with https://github.com/kamiyaa/joshuto/commit/31beaabe6b2cf4119aacae6c1722cdc1e5ba2f5b :tada::

keymap = [
{ keys = ["*"], commands = ["/home/xfzv/.config/joshuto/toggle_executable.sh %s", "reload_dirlist"], description = "Toggle executable" },
]
Beethoven-n commented 11 months ago

what're we waiting for? everything looks good from here

Dzordzu commented 11 months ago

I need to resolve conflicts, add more documentation. Furthermore I'm required to find a spare time and a will to contribute (a little personal issues, sorry for that!)

kamiyaa commented 11 months ago

Just ping me when its ready!

Dzordzu commented 11 months ago

I messed it so badly, that I needed to open another PR. Working at nights is really funny!