Skip to content
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

Add ---exec-shell option #1406

Open
4 tasks
tmccombs opened this issue Oct 23, 2023 · 1 comment
Open
4 tasks

Add ---exec-shell option #1406

tmccombs opened this issue Oct 23, 2023 · 1 comment

Comments

@tmccombs
Copy link
Collaborator

As mentioned in #1354 (comment)

There are many cases where it is desirable to use --exec or --exec-batch` with a shell command, including having access to aliases and shell functions, being able to use pipes and redirection, etc.

Having an option that automatically handles the boilerplate of $SHELL -c for you would make those use cases a lot more convenient.

Before jumping in and implementing this though, there are some open questions I would like answered:

  • What shell is used? On unix systems, do we use the value of the SHELL environment variable, always use sh, try to use bash with a fallback to sh, or maybe try to use SHELL but fall back to sh? On Windows, do we use powershell or cmd.exe? And if the former, what do we do if it isn't available? what about cygwin?
    • Are unix shells consistent in supporting -c? I don't know of any that don't, but do we need to worry about SHELL being set to something weird that doesn't?
  • How should the command be passed in? As a single string argument? As an arbitrary number of arguments that are joined by spaces? I'm leaning towards a single string.
  • Should we support --exec-shell-batch or just --exec-shell?
@j-lakeman
Copy link

e.g. a self-defined function like that:

function trash
        gio trash $argv
end
fd --type file --type empty --exec trash                   ✘ 1
[fd error]: Command not found: trash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants