console
console copied to clipboard
warnings: toggleable warnings
Users should be able to turn individual warnings on and off, using the command line and/or possibly an eventual config file. I discussed this briefly in https://github.com/tokio-rs/console/issues/56#issuecomment-916256883.
Here's a rough summary of how I imagine this would work:
- [ ] Add a (reasonably) short, CLI-friendly name to lints.
- This would probably be a short string name without spaces, something like
self_wake_percentfor the self-wake percentage lint. - We may also want to add numeric identifiers for lints.
- This could be done by adding a function to the
warnings::Warntrait returning an&'static str? It would unfortunately have to be a function rather than an associated const, since theWarntrait has to be object-safe.
- This would probably be a short string name without spaces, something like
- [ ] Store warnings in some kind of map from short names -> warnings.
- One potential way to do this is using a compile-time hashmap like the
phfcrate.
- One potential way to do this is using a compile-time hashmap like the
- [ ] Add a CLI flag taking a list of lints to disable.
- We may also want to add one that takes a list of lints to enable, in case we add lints that are not enabled by default
- This would also be useful coupled with a
--no-default-lintsor similar.
- [ ] When the console starts, we would construct the list of lints based on the CLI arguments if they are provided.