-
Notifications
You must be signed in to change notification settings - Fork 121
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
glob paths to ignore files using .gitignore #542
Comments
can you explain your use case and provide a makefile example of what you are doing that requires this? |
My use case atm is selecting files to be linted, specifically Python and QML files. |
can you show an example task toml? so I'll understand how you trigger that? because i'm trying to understand how you pull the files to lint in the first place. in rust for example, these tools are project aware and you don't need to pass anything |
@jayvdb can you provide an example of how the usage would be? |
We are not trying to use this for rust tools. It is other languages, and tools, that we need to do processing of in steps intermingled with the rust build process, as the rust code depends on them. |
@jayvdb i got that point already when you said linting py files. the solution you requested is:
but there is no env globals in cargo-make so your solution is not clear for me. |
sorry |
again there is no glob handling in cargo-make at the moment and i didn't get any feedback fromyou on how you see a solution. |
@jayvdb i'm thinking of an internal cargo make way to defining env vars with globs and respecting gitignore. [env]
MY_C_FILES = { glob = "./src/**/*.c", ignore_type="git", include_files = true, include_dirs = false}
[tasks.print-c-files]
command = "echo"
args = ["@@split(MY_C_FILES,;)"] Might take me a bit, but once done, you will have the ability to run commands on sets of files without any scripting. |
Thanks for The proposed builtin support for globbing looks great, however I dont understand the I guess then we should also have the separator be supplied with the glob IMO the separator default for multi-entry env vars should be |
no the split is not related to duckscript. list env vars in cargo-make use the ';' separator, and than with the split by it, you will get many arguments (one per path) to the command. |
@jayvdb this is now available in the dev branch 0.32.17 can you please verify it works well for your needs? [env]
PY_FILES = { glob = "./src/**/*.py", include_files = true, include_dirs = false, ignore_type = "git" }
[tasks.echo_py]
command = "echo"
args = ["@@split(PY_FILES,;)"] |
this is now officially released |
Feature Description
glob paths set using
env
should not include files which are excluded by.gitignore
.c.f. rust-lang/cargo#2063
Describe The Solution You'd Like
Files excluded via
.gitignore
are excluded by default fromenv
globs.Or env globs have
include
/exclude
overrides and docs highlight that 'hidden' files may be included unlessexclude
is used.Code Sample
https://github.com/rust-lang/cargo/blob/58a961314437258065e23cb6316dfc121d96fb71/src/cargo/sources/path.rs uses https://crates.io/crates/ignore
https://github.com/jhspetersson/fselect/tree/a1d17018f70c79af17df458f7a2878fb422d7da8/src/ignore includes support for .dockerignore and .hgignore
The text was updated successfully, but these errors were encountered: