Canop / broot

A new way to see and navigate directory trees : https://dystroy.org/broot
MIT License
10.62k stars 234 forks source link

Run shell commands like tar and zip directly through broot terminal UI. #873

Open sohan-deshar opened 5 months ago

sohan-deshar commented 5 months ago

Hi all. I couldn't find anything mentioned in the docs regarding the ability to run simple shell commands like tar and zip.

It would be nice to have such features (if there already isn't a way to do it), so that I won't have to leave broot.

Canop commented 2 months ago

In my experience, there aren't so many cases when you run a command just taking the current file as path. You often need to pipe, or to specify another path.

For simple cases, a verb like this can be defined:

    {
        invocation: "exe {command}"
        external: ["bash" "-c" "{command} {file}"]
        leave_broot: false
    }

This allows typing eg :exe touch or :exe chmod +x and have the command applied to the selected file.

But in practice I'd just define the very few verbs for those actions.

(still interested with feedback on this)

adriangalilea commented 2 months ago

For simple cases, a verb like this can be defined:

    {
        invocation: "exe {command}"
        external: ["bash" "-c" "{command} {file}"]
        leave_broot: false
    }

This allows typing eg :exe touch or :exe chmod +x and have the command applied to the selected file.

But in practice I'd just define the very few verbs for those actions.

(still interested with feedback on this)

I would like to run add on from my functions sourced on .zshrc so when I do :exe add it fails since it doesn't exist in that context, however if I remove "bash" "-c" it does not work.

What options do I have besides sourcing inside sub-shell?