From f9a5867d3eecd03e6ffbd982fc573caceb0bb2ac Mon Sep 17 00:00:00 2001 From: messense Date: Sun, 8 Jan 2023 10:54:19 +0800 Subject: [PATCH] Add `RUFF_FORMAT` environment variable support (#1731) Resolves #1716 --- Cargo.toml | 2 +- README.md | 2 +- src/cli.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 04fe039a1a..e7d44a931e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ bitflags = { version = "1.3.2" } cachedir = { version = "0.3.0" } cfg-if = { version = "1.0.0" } chrono = { version = "0.4.21", default-features = false, features = ["clock"] } -clap = { version = "4.0.1", features = ["derive"] } +clap = { version = "4.0.1", features = ["derive", "env"] } clap_complete_command = { version = "0.4.0" } colored = { version = "2.0.0" } dirs = { version = "4.0.0" } diff --git a/README.md b/README.md index 1f0a44b9a5..1baf27c182 100644 --- a/README.md +++ b/README.md @@ -362,7 +362,7 @@ Options: --per-file-ignores List of mappings from file pattern to code to exclude --format - Output serialization format for error messages [possible values: text, json, junit, grouped, github, gitlab] + Output serialization format for error messages [env: RUFF_FORMAT=] [possible values: text, json, junit, grouped, github, gitlab] --stdin-filename The name of the file when passing it through stdin --cache-dir diff --git a/src/cli.rs b/src/cli.rs index 2cf28398a8..fa2b8628dd 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -93,7 +93,7 @@ pub struct Cli { #[arg(long, value_delimiter = ',')] pub per_file_ignores: Option>, /// Output serialization format for error messages. - #[arg(long, value_enum)] + #[arg(long, value_enum, env = "RUFF_FORMAT")] pub format: Option, /// The name of the file when passing it through stdin. #[arg(long)]