-
-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Execute program with file name(s) as argument #695
Comments
Today, it's possible to define a verb like this:
With such a verb you can type Allowing |
This works great with single files, thank you. However, this doesn't behave as expected with the staging area. If I stage a few files and run |
Yes, the behavior of verbs on the staging area today is to execute sequentially. |
Hi,
and , on broot , I select the script , then I write But the command is not successful . On bash |
It's a little more complex for a shell script than for an executable. What's your shell script doing ? Can you post it here (or a shortened variant) ? |
Every bash script I run don't work
|
You have to call an executable, to run your script. For example:
If your script takes arguments:
|
As I realize this may not be obvious, I'm adding a section in the doc: https://dystroy.org/broot/conf_verbs/#call-shell-scripts |
Hi,
I have another question, for making script launching even better. |
You mean type the flag in broot ? Yes:
Select your executable then type 'r' and enter to execute it without flag, or 'rf h' to execute it with '-h'. |
Hi my final code is the following
Many thanks! |
This is very interesting and it has a lot of potential applications. I think it should be highlighted in the web or another place (maybe another blog post?). Related to #152. In my opinion, it would be more flexible if you could type any command and use placeholders to indicate file and (parent if it is a file) directory. That would be a great addition to broot! In a future stage, commands could be suggested (à la vim commands) in relation to the MIME type of the file, this would be related to #823. Thanks. |
I'm sorry but I don't follow you here. Could you give some examples ? |
Of course. It could be like the syntax for creating verbs in hjson/TOML files but directly into broot for one-time commands that you will probably not execute anymore (so configuring the verb does not pay off). Some examples:
We could name them something like 'live verbs'. For the commands recommendation, it could be triggered when typing and optionally using and special shortcut (probably Thanks. |
This seems like an obvious thing, so I apologise if it's duplicated somewhere.
We can define verbs that execute arbitrary commands, but there doesn't seem to be a way to run commands from within broot itself. I don't want to define every single command I might use as a verb; it should be possible to run something like
!vim %
to run Vim with the current file being highlighted passed as an argument.This should also work with the staging area: if multiple files are selected, they should expand into the arguments. E.g., if the staging area contains files
a.txt
andb.txt
,!vim %
would executevim a.txt b.txt
.The text was updated successfully, but these errors were encountered: