Implement shell autocompletion for rule codes

For example:

    $ ruff check --select=EM<Tab>
    EM          -- flake8-errmsg
    EM10   EM1  --
    EM101       -- raw-string-in-exception
    EM102       -- f-string-in-exception
    EM103       -- dot-format-in-exception

(You will need to enable autocompletion as described
 in the Autocompletion section in the README.)

Fixes #2808.

(The --help help change in the README is due to a clap bug,
 for which I already submitted a fix:
 https://github.com/clap-rs/clap/pull/4710.)
This commit is contained in:
Martin Fischer 2023-02-15 00:33:49 +01:00 committed by Charlie Marsh
parent ca49b00e55
commit 70e378b736
5 changed files with 86 additions and 7 deletions

View file

@ -57,6 +57,7 @@ pub fn register_rules(input: &Input) -> proc_macro2::TokenStream {
PartialOrd,
Ord,
AsRefStr,
::strum_macros::IntoStaticStr,
)]
#[strum(serialize_all = "kebab-case")]
pub enum Rule { #rule_variants }