-
-
Notifications
You must be signed in to change notification settings - Fork 612
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
Extended globbing support #225
Comments
Hi @Yottum, I think this just isn't supported by https://github.com/mattn/go-zglob. Can you check if you glob use cases work on Gosh? You can do that by installing Gosh and running: gosh -c "echo ./!(vendor)/**/*.go" Or by running it in Taskfile like this: tasks:
glob:
- echo ./!(vendor)/**/*.go If it works, we could maybe replace zglob with Gosh for globbing in Task. |
Ping @Yottum |
Woops, sorry! Had totally forgotten I opened this issue. Thanks for replying. No avail, sadly:
|
I'm not seeing many go implementations that support negation syntax. https://github.com/gobwas/glob doesn't directly implement filesystem search. https://godoc.org/gopkg.in/godo.v2/glob appears to support negation, but is a bit stale. |
I just opened an issue on the glob lib we currently use: mattn/go-zglob#26. I wouldn't expect that to be implemented soon, though. |
also, perhaps another approach is an explicit exclusion glob similar to https://github.com/githubnemo/CompileDaemon/blob/master/daemon.go#L45 |
This also sounds like a good idea |
See #309 |
I just stumbled upon https://github.com/bmatcuk/doublestar that supports negation of character classes. |
Update: mattn/go-zglob#26 (Add glob negation support) has just been implemented! |
@andreynering could we get a new release with updated |
Dug into this a little bit as I also wanted to exclude the The stacktrace I get (which is the same as OP) is actually pointing to an error caused by mvdan/sh. It looks like this issue is what we need for this to work in Taskfile. |
I'm working on this in the V4 Discussion #694 by turning the
|
I'm a bit curious how sh comes into play for |
Oh, I wanted to add one more thing, that I was also thinking about adding support to automatically read in a |
FYI the negation feature just got tagged: https://github.com/mattn/go-zglob/releases/tag/v0.0.4 |
the globbing library that The following checks the files inside the
But this doesn't!
Or for example, |
Another issue with the go-zglob library is that it is very slow. It still tries to read the excluded directory using the sources:
["node_modules/**/*", "**/*.js"] I have done some profiling on my fork, and here is the result. As you see, it reads the whole node_modules directory, which takes 70 seconds. |
I really need this negation support in my beloved tool "task" ;) I have some generated sources under some directory that usually holds only regular sources and I need to exclude them without listing all dirs separately as sources to cover that. I know that it is ugly but currently, the only way to make build caching work. To do it elegantly I need to have it implemented in Task for sure. Unfortunately, I am unable to reconfigure the build to move these generated sources somewhere else. Could we somehow push this feature forward? May I help somehow? |
One suggestion would be to support a shell command that produces the necessary watched paths. Then, users can use a tool like tasks:
foo:
sources_command: "fd -lp --exclude='**/*.cache.*' --glob '**/packages/{site,backend}/**/*.{go,js,ts,json}'" I'm using
|
@thenbe I like the idea because currently as far as I investigated there is no nice Go library to support exclusions with the glob patterns that we use currently (without introducing backward incompatible change). Your extension to the task tool will be backward-compatible. However a little bit annoying then will be a need to provide I am using the task tool intensively and adopting it in my company however the lack of exclusions in sources is really annoying. Instead of having a single source pattern with one negation, I need to list many paths separately (to avoid treat generated files as sources) which is very error-prone as these path structures may change/are under active development. If I could somehow help in pushing that topic forward, please let me know. I could contribute but at least I need to be sure which kind of improvements will be accepted and merged into the tool. @andreynering, @pd93 maybe? |
@krystian-panek-wttech I think it's very unlikely that Task will ever embed another binary. If you need the functionality of With that said, this issue has been bothering me for a long time. |
I will give it a try and let you know. the implementation looks good enough / promising. thank you very much for your time! ;) |
Using extglob patterns in
sources
entries makes Task panic. I tried using this to exclude some files from being picked up.Given the following
Taskfile.yml
:Task panics after running
task foo
:The text was updated successfully, but these errors were encountered: