-
Notifications
You must be signed in to change notification settings - Fork 109
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
Feature request: pass watched files as command line arg/flag (NOT via pipe) #33
Comments
I probably will not add this feature, but similar requests have come up before, and this has some merit. My approach has been to design a tool that did one thing and do it well. Reading the list of files on
Should I finally let go of this approach? Some alternate approaches might be
The problem will all these examples is that they only solve a small set of problems, they introduce yet more to read in the man page. Instead I have been steering people to use non-standard file search tools such as
Back to your feature request: nearly always you can just run a shell
And for just one file, there is special syntax (
I know this was a simple request, but
That last point is the one that bothers me the most. I almost expect someone fork entr and redesign parts of it around this idea, but this hasn't happened yet to my knowledge. |
https://github.com/jakolehm/nightwatch implements this now:
since there is no pipeline (there can be, it also supports STDIN), it's also easier to terminate in a shell script. |
Thanks for your thorough explanation @eradman. This all makes sense, and I've found a workaround for my use case.
Unfortunately this is one case we can't :-/ I've found a workaround though. Here's my use case/solution in case you're curious, but it's nothing you need to worry about if not! Basically I want to run apiVersion: v1
kind: Pod
...
spec:
containers:
...
command: ["sh", "-c", "echo restart-process.txt | entr -rz my_util.sh"]
args: ["arg1", "arg2", "--someFlag"] In the pod itself, that results in a call:
The way this gets evaluated, the args/flags specified apply to The solution was a precompiled binary that takes a file(s) as an arg and calls out to
Here's the wrapper I wrote, if you're curious. Again, this is all nerdy context on my issue but nothing you need to take action on--I'm all set for now :) |
@maiamcc that is some very good context. I'm going to leave this ticket open for now in case anyone else wants to chime in with ideas |
What about reading the watched files from an external file (one per line) as an alternative to |
Hello bfrg,
bfrg writes:
What about reading the watched files from an external file (one per line) as an alternative to `STDIN`? Something like `entr -f FILE` and `entr --file=FILE`.
Couldn't such file just be passed via mechanisms provided by most
shells, e.g. by piping it in or via `<' redirect?
How would that differ?
|
@bfrg Nevermind, I was completely out of context because I've read that via email and missed previous discussions. |
@iamleot I personally don't need this feature at the moment but I thought I mention it as an alternative since it hasn't been brought up yet. Parsing a file is probably easier than parsing command-line arguments. Besides, the file can be arbitrarily large whereas command-line arguments are limited by (I think) |
Parsing a file is also trivially easy for a program that already parses stdin, which is just another file from the perspective of a C program. Still, I resonate with @eradman's hesitation to add this. Even though it does make certain use cases easier, it's not as flexible and useful as a pipe.
It was mentioned1:
|
Thanks for the feedback all! The pipe is a problem in some corner cases, but it also provides flexibility for most cases. Closing |
(Unless of course this feature already exists, in which case, great!)
I'd like to be able to use
entr
on Docker images without bash/sh, which means that piping won't be available to me; ideally I would be able to specify files to watch as an arg, e.g.(A smaller point in favor of this feature is that while piping makes perfect sense for a call like
ls | entr ...
, if i just want to watch a single file, it looks a little silly to sayecho one-file.txt | entr ...
)The text was updated successfully, but these errors were encountered: