How to replace `cargo-watch` with Bacon?
I read https://github.com/watchexec/cargo-watch/releases/tag/v8.5.3 and I would like to know how to use Bacon instead of it.
Right now the only usage I need is to relaunch the project with cargo run if some file changes in some specific directory excluding some files.
I'm using:
cargo watch --ignore "dir1" --ignore "dir2/dir3/dir4" --ignore "dir7" --ignore "tests.rs" -x run
Is there an equivalent bacon command?
Thanks a lot for your job!
Do you really need to ignore files which aren't in the .gitignore ?
If not, just do
bacon run
Or alternatively, launch bacon with bacon, then hit r.
Thank you for the answer.
I don't understand: is there a way to launch bacon with that "ignore" flags?
Or using a .toml file?
I need to ignore many directories which are NOT ignored in .gitignore.
is there a way to launch bacon with that "ignore" flags?
If you don't want bacon to watch the default "source" files and directories (["src", "tests", "benches", "examples", "build.rs"]), you may set default_watch to false and set your own watch list: https://dystroy.org/bacon/config/#jobs
But we might have a misunderstanding: what are those directories you want to ignore that aren't currently ignored by bacon ?
In one of my project for example I have a "sources" directory which I change manually or from another software.
Then this directory content is used in the cargo project I'm watching. But I don't want to re-run the project when that directory content changes.
And this directory is not in .gitignore.
You're suggesting a whitelist. I'm searching for a blacklist, right?
You're suggesting a whitelist. I'm searching for a blacklist, right?
Before to add a blacklist feature in bacon, I'm trying to understand how one can end up needing a blacklist, and whether that's a real need. There are already many parameters in bacon and I never rush to add some before verifying they're useful.
If your folder is called "sources", then it's not watched by bacon anyway. But perhaps you meant it's inside one of the ["src", "tests", "benches", "examples", "build.rs"] directories ?
In such case, the best solution would be to add a ignore = [...] setting in jobs, right ?
Yeah, it's inside a sub-directory under the main "src" one.
Any option is fine for me.
It would also be useful to have it as an arg for the bacon executable, as it is for cargo watch:
cargo watch --ignore "dir1" --ignore "dir2/dir3/dir4" --ignore "dir7" --ignore "tests.rs" -x run
Is this released?
Not yet. It will be in 3.3.
Note that part of the delay between implementation and release is due to my tests (in prod). If people test the feature (in main) then report that it looks OK, the delay may be shortened.