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

--exclude flag could use better documentation #259

Open
marrip opened this issue Mar 9, 2023 · 2 comments
Open

--exclude flag could use better documentation #259

marrip opened this issue Mar 9, 2023 · 2 comments

Comments

@marrip
Copy link

marrip commented Mar 9, 2023

Hey,

I was a bit confused on how the --exclude flag works. I tried different approaches like defining it multiple times or separating the different regexes with spaces but nothing worked and the docs did not make any suggestion on how it is handled. I checked the code and realized that it should be --exclude "regex1|regex2|regex3". I think it would be beneficial for users to have this somewhere explained to ease usage. Thank you 🙂

@generalmimon
Copy link
Contributor

Yeah, currently only the last -exclude setting gets picked up and any previous setting is silently ignored (NB: no \.rb$ in "Exclude Regexp"):

$ ec -verbose -exclude '\.rb$' -exclude '\.gemspec$'
Exclude Regexp: \.gemspec$|^\.yarn/|^yarn\.lock$|^package-lock\.json$|^composer\.lock$|^Cargo\.lock$|^Gemfile\.lock$|^\.pnp\.cjs$|^\.pnp\.js$|^\.pnp\.loader\.mjs$|\.snap$|\.otf$|\.woff$|\.woff2$|\.eot$|\.ttf$|\.gif$|\.png$|\.jpg$|\.jpeg$|\.webp$|\.avif$|\.mp4$|\.wmv$|\.svg$|\.ico$|\.bak$|\.bin$|\.pdf$|\.zip$|\.gz$|\.tar$|\.7z$|\.bz2$|\.log$|\.patch$|\.css\.map$|\.js\.map$|min\.css$|min\.js$

Ironically, this project's own Makefile doesn't account for this either:

run: build ## Build and run bin/ec
@./bin/ec --exclude "\\.git" --exclude "\\.exe$$"
run-verbose: build ## Build and run bin/ec --verbose
@./bin/ec --verbose --exclude "\\.git" --exclude "\\.exe$$"

It would be great if multiple -excludes were all picked up and merged into the regexp as alternatives (like the Exclude array in JSON configuration), as many of us would intuitively expect. An inferior alternative (but still better than the current silent "last wins" overwrite) would be to detect multiple -exclude settings and inform the user that only the last one was applied - but I guess that the proper fix of just adding support for multiple -excludes would actually be easier to implement than this ;)

@mstruebing
Copy link
Member

Anyone willing to create a PR for this?

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

3 participants