From 7aa8eb0f4840a859fe4552bb4b08bebeae398650 Mon Sep 17 00:00:00 2001 From: Alex Povel Date: Sun, 11 Aug 2024 11:23:20 +0200 Subject: [PATCH] chore(cli): Provide clearer value names for language queries --- README.md | 12 ++++++------ src/main.rs | 15 +++++++++------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 307c7052..715952b0 100644 --- a/README.md +++ b/README.md @@ -1364,7 +1364,7 @@ Language scopes: interpolated) - usings: `using` directives (including periods) - --csharp-query + --csharp-query Scope C# code using a custom tree-sitter query. [env: CSHARP_QUERY=] @@ -1380,7 +1380,7 @@ Language scopes: - imports: Imports - struct-tags: Struct tags - --go-query + --go-query Scope Go code using a custom tree-sitter query. [env: GO_QUERY=] @@ -1407,7 +1407,7 @@ Language scopes: - comments: Comments - strings: Literal strings - --hcl-query + --hcl-query Scope HashiCorp Configuration Language code using a custom tree-sitter query. [env: HCL_QUERY=] @@ -1444,7 +1444,7 @@ Language scopes: assignments) - types: Types in type hints - --python-query + --python-query Scope Python code using a custom tree-sitter query. [env: PYTHON_QUERY=] @@ -1462,7 +1462,7 @@ Language scopes: - strings: Strings (regular, raw, byte; includes interpolation parts in format strings!) - --rust-query + --rust-query Scope Rust code using a custom tree-sitter query. [env: RUST_QUERY=] @@ -1477,7 +1477,7 @@ Language scopes: - strings: Strings (literal, template) - imports: Imports (module specifiers) - --typescript-query + --typescript-query Scope TypeScript code using a custom tree-sitter query. [env: TYPESCRIPT_QUERY=] diff --git a/src/main.rs b/src/main.rs index 47d9381d..a5f04c05 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1163,6 +1163,9 @@ mod cli { pub squeeze: bool, } + /// For use as + const TREE_SITTER_QUERY_VALUE_NAME: &str = "TREE-SITTER-QUERY"; + #[derive(Parser, Debug)] #[group(required = false, multiple = false)] #[command(next_help_heading = "Language scopes")] @@ -1189,7 +1192,7 @@ mod cli { pub csharp: Option, /// Scope C# code using a custom tree-sitter query. - #[arg(long, env, verbatim_doc_comment)] + #[arg(long, env, verbatim_doc_comment, value_name = TREE_SITTER_QUERY_VALUE_NAME)] pub csharp_query: Option, } @@ -1203,7 +1206,7 @@ mod cli { #[allow(clippy::doc_markdown)] // CamelCase detected as 'needs backticks' /// Scope HashiCorp Configuration Language code using a custom tree-sitter query. - #[arg(long, env, verbatim_doc_comment)] + #[arg(long, env, verbatim_doc_comment, value_name = TREE_SITTER_QUERY_VALUE_NAME)] pub hcl_query: Option, } @@ -1215,7 +1218,7 @@ mod cli { pub go: Option, /// Scope Go code using a custom tree-sitter query. - #[arg(long, env, verbatim_doc_comment)] + #[arg(long, env, verbatim_doc_comment, value_name = TREE_SITTER_QUERY_VALUE_NAME)] pub go_query: Option, } @@ -1227,7 +1230,7 @@ mod cli { pub python: Option, /// Scope Python code using a custom tree-sitter query. - #[arg(long, env, verbatim_doc_comment)] + #[arg(long, env, verbatim_doc_comment, value_name = TREE_SITTER_QUERY_VALUE_NAME)] pub python_query: Option, } @@ -1239,7 +1242,7 @@ mod cli { pub rust: Option, /// Scope Rust code using a custom tree-sitter query. - #[arg(long, env, verbatim_doc_comment)] + #[arg(long, env, verbatim_doc_comment, value_name = TREE_SITTER_QUERY_VALUE_NAME)] pub rust_query: Option, } @@ -1251,7 +1254,7 @@ mod cli { pub typescript: Option, /// Scope TypeScript code using a custom tree-sitter query. - #[arg(long, env, verbatim_doc_comment)] + #[arg(long, env, verbatim_doc_comment, value_name = TREE_SITTER_QUERY_VALUE_NAME)] pub typescript_query: Option, }