ast-grep-cli 0.40.3__tar.gz → 0.40.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/Cargo.lock +67 -61
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/Cargo.toml +6 -6
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/PKG-INFO +1 -1
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/lib.rs +5 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/print/colored_print.rs +2 -2
- ast_grep_cli-0.40.4/crates/cli/src/print/file_name_printer.rs +105 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/print/mod.rs +3 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/run.rs +7 -1
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/scan.rs +7 -2
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/utils/args.rs +9 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/tests/help_test.rs +2 -2
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/tests/run_test.rs +13 -13
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/tests/scan_test.rs +24 -24
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/Cargo.toml +1 -1
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/pyproject.toml +1 -1
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/LICENSE +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/README.md +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/Cargo.toml +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/README.md +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/bin/alias.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/completions.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/config.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/lang/injection.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/lang/lang_globs.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/lang/mod.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/lsp.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/main.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/new.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/print/cloud_print.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/print/colored_print/markdown.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/print/colored_print/match_merger.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/print/colored_print/styles.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/print/colored_print/test.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/print/interactive_print.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/print/json_print.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/utils/debug_query.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/utils/error_context.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/utils/inspect.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/utils/mod.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/utils/print_diff.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/utils/rule_overwrite.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/utils/worker.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/verify/case_result.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/verify/find_file.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/verify/reporter.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/verify/snapshot.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/verify/test_case.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/src/verify.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/tests/common/mod.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/cli/tests/verify_test.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/Cargo.toml +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/check_var.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/combined.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/fixer.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/label.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/lib.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/maybe.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/rule/deserialize_env.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/rule/mod.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/rule/nth_child.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/rule/range.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/rule/referent_rule.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/rule/relational_rule.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/rule/selector.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/rule/stop_by.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/rule_collection.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/rule_config.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/rule_core.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/transform/mod.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/transform/parse.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/transform/rewrite.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/transform/string_case.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/config/src/transform/trans.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/Cargo.toml +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/language.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/lib.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/match_tree/match_node.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/match_tree/mod.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/match_tree/strictness.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/matcher/kind.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/matcher/node_match.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/matcher/pattern.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/matcher/text.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/matcher.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/meta_var.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/node.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/ops.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/pinned.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/replacer/indent.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/replacer/structural.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/replacer/template.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/replacer.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/source.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/tree_sitter/mod.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/core/src/tree_sitter/traversal.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/dynamic/Cargo.toml +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/dynamic/src/custom_lang.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/dynamic/src/lib.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/bash.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/cpp.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/csharp.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/css.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/elixir.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/go.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/haskell.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/hcl.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/html.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/json.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/kotlin.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/lib.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/lua.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/nix.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/parsers.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/php.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/python.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/ruby.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/rust.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/scala.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/solidity.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/swift.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/language/src/yaml.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/lsp/Cargo.toml +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/lsp/src/lib.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/lsp/src/utils.rs +0 -0
- {ast_grep_cli-0.40.3 → ast_grep_cli-0.40.4}/crates/lsp/tests/basic.rs +0 -0
|
@@ -103,7 +103,7 @@ dependencies = [
|
|
|
103
103
|
|
|
104
104
|
[[package]]
|
|
105
105
|
name = "ast-grep"
|
|
106
|
-
version = "0.40.
|
|
106
|
+
version = "0.40.4"
|
|
107
107
|
dependencies = [
|
|
108
108
|
"ansi_term",
|
|
109
109
|
"anyhow",
|
|
@@ -138,7 +138,7 @@ dependencies = [
|
|
|
138
138
|
|
|
139
139
|
[[package]]
|
|
140
140
|
name = "ast-grep-config"
|
|
141
|
-
version = "0.40.
|
|
141
|
+
version = "0.40.4"
|
|
142
142
|
dependencies = [
|
|
143
143
|
"ast-grep-core",
|
|
144
144
|
"bit-set",
|
|
@@ -153,7 +153,7 @@ dependencies = [
|
|
|
153
153
|
|
|
154
154
|
[[package]]
|
|
155
155
|
name = "ast-grep-core"
|
|
156
|
-
version = "0.40.
|
|
156
|
+
version = "0.40.4"
|
|
157
157
|
dependencies = [
|
|
158
158
|
"bit-set",
|
|
159
159
|
"regex",
|
|
@@ -164,7 +164,7 @@ dependencies = [
|
|
|
164
164
|
|
|
165
165
|
[[package]]
|
|
166
166
|
name = "ast-grep-dynamic"
|
|
167
|
-
version = "0.40.
|
|
167
|
+
version = "0.40.4"
|
|
168
168
|
dependencies = [
|
|
169
169
|
"ast-grep-core",
|
|
170
170
|
"ignore",
|
|
@@ -178,7 +178,7 @@ dependencies = [
|
|
|
178
178
|
|
|
179
179
|
[[package]]
|
|
180
180
|
name = "ast-grep-language"
|
|
181
|
-
version = "0.40.
|
|
181
|
+
version = "0.40.4"
|
|
182
182
|
dependencies = [
|
|
183
183
|
"ast-grep-core",
|
|
184
184
|
"ignore",
|
|
@@ -213,7 +213,7 @@ dependencies = [
|
|
|
213
213
|
|
|
214
214
|
[[package]]
|
|
215
215
|
name = "ast-grep-lsp"
|
|
216
|
-
version = "0.40.
|
|
216
|
+
version = "0.40.4"
|
|
217
217
|
dependencies = [
|
|
218
218
|
"anyhow",
|
|
219
219
|
"ast-grep-config",
|
|
@@ -231,7 +231,7 @@ dependencies = [
|
|
|
231
231
|
|
|
232
232
|
[[package]]
|
|
233
233
|
name = "ast-grep-napi"
|
|
234
|
-
version = "0.40.
|
|
234
|
+
version = "0.40.4"
|
|
235
235
|
dependencies = [
|
|
236
236
|
"ast-grep-config",
|
|
237
237
|
"ast-grep-core",
|
|
@@ -247,7 +247,7 @@ dependencies = [
|
|
|
247
247
|
|
|
248
248
|
[[package]]
|
|
249
249
|
name = "ast-grep-py"
|
|
250
|
-
version = "0.40.
|
|
250
|
+
version = "0.40.4"
|
|
251
251
|
dependencies = [
|
|
252
252
|
"anyhow",
|
|
253
253
|
"ast-grep-config",
|
|
@@ -344,9 +344,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
|
|
344
344
|
|
|
345
345
|
[[package]]
|
|
346
346
|
name = "clap"
|
|
347
|
-
version = "4.5.
|
|
347
|
+
version = "4.5.54"
|
|
348
348
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
349
|
-
checksum = "
|
|
349
|
+
checksum = "c6e6ff9dcd79cff5cd969a17a545d79e84ab086e444102a591e288a8aa3ce394"
|
|
350
350
|
dependencies = [
|
|
351
351
|
"clap_builder",
|
|
352
352
|
"clap_derive",
|
|
@@ -354,9 +354,9 @@ dependencies = [
|
|
|
354
354
|
|
|
355
355
|
[[package]]
|
|
356
356
|
name = "clap_builder"
|
|
357
|
-
version = "4.5.
|
|
357
|
+
version = "4.5.54"
|
|
358
358
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
359
|
-
checksum = "
|
|
359
|
+
checksum = "fa42cf4d2b7a41bc8f663a7cab4031ebafa1bf3875705bfaf8466dc60ab52c00"
|
|
360
360
|
dependencies = [
|
|
361
361
|
"anstream",
|
|
362
362
|
"anstyle",
|
|
@@ -366,9 +366,9 @@ dependencies = [
|
|
|
366
366
|
|
|
367
367
|
[[package]]
|
|
368
368
|
name = "clap_complete"
|
|
369
|
-
version = "4.5.
|
|
369
|
+
version = "4.5.64"
|
|
370
370
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
371
|
-
checksum = "
|
|
371
|
+
checksum = "4c0da80818b2d95eca9aa614a30783e42f62bf5fdfee24e68cfb960b071ba8d1"
|
|
372
372
|
dependencies = [
|
|
373
373
|
"clap",
|
|
374
374
|
]
|
|
@@ -929,9 +929,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
|
|
929
929
|
|
|
930
930
|
[[package]]
|
|
931
931
|
name = "libc"
|
|
932
|
-
version = "0.2.
|
|
932
|
+
version = "0.2.178"
|
|
933
933
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
934
|
-
checksum = "
|
|
934
|
+
checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091"
|
|
935
935
|
|
|
936
936
|
[[package]]
|
|
937
937
|
name = "libloading"
|
|
@@ -945,9 +945,9 @@ dependencies = [
|
|
|
945
945
|
|
|
946
946
|
[[package]]
|
|
947
947
|
name = "linux-raw-sys"
|
|
948
|
-
version = "0.
|
|
948
|
+
version = "0.11.0"
|
|
949
949
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
950
|
-
checksum = "
|
|
950
|
+
checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"
|
|
951
951
|
|
|
952
952
|
[[package]]
|
|
953
953
|
name = "litrs"
|
|
@@ -1022,9 +1022,9 @@ dependencies = [
|
|
|
1022
1022
|
|
|
1023
1023
|
[[package]]
|
|
1024
1024
|
name = "napi"
|
|
1025
|
-
version = "3.
|
|
1025
|
+
version = "3.8.1"
|
|
1026
1026
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1027
|
-
checksum = "
|
|
1027
|
+
checksum = "000f205daae6646003fdc38517be6232af2b150bad4b67bdaf4c5aadb119d738"
|
|
1028
1028
|
dependencies = [
|
|
1029
1029
|
"anyhow",
|
|
1030
1030
|
"bitflags",
|
|
@@ -1046,9 +1046,9 @@ checksum = "d376940fd5b723c6893cd1ee3f33abbfd86acb1cd1ec079f3ab04a2a3bc4d3b1"
|
|
|
1046
1046
|
|
|
1047
1047
|
[[package]]
|
|
1048
1048
|
name = "napi-derive"
|
|
1049
|
-
version = "3.
|
|
1049
|
+
version = "3.5.0"
|
|
1050
1050
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1051
|
-
checksum = "
|
|
1051
|
+
checksum = "97ef4e39564b008771df9a4983e4ea6c1f7fa6ad5252347b6dbf7f347a8f689a"
|
|
1052
1052
|
dependencies = [
|
|
1053
1053
|
"convert_case 0.10.0",
|
|
1054
1054
|
"ctor",
|
|
@@ -1060,9 +1060,9 @@ dependencies = [
|
|
|
1060
1060
|
|
|
1061
1061
|
[[package]]
|
|
1062
1062
|
name = "napi-derive-backend"
|
|
1063
|
-
version = "
|
|
1063
|
+
version = "5.0.0"
|
|
1064
1064
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1065
|
-
checksum = "
|
|
1065
|
+
checksum = "eb0d9a16e3fbfd6397f97e4eaafe9fbefb888a6120dd289dd12869fdb16af372"
|
|
1066
1066
|
dependencies = [
|
|
1067
1067
|
"convert_case 0.10.0",
|
|
1068
1068
|
"proc-macro2",
|
|
@@ -1217,9 +1217,9 @@ dependencies = [
|
|
|
1217
1217
|
|
|
1218
1218
|
[[package]]
|
|
1219
1219
|
name = "pyo3"
|
|
1220
|
-
version = "0.27.
|
|
1220
|
+
version = "0.27.2"
|
|
1221
1221
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1222
|
-
checksum = "
|
|
1222
|
+
checksum = "ab53c047fcd1a1d2a8820fe84f05d6be69e9526be40cb03b73f86b6b03e6d87d"
|
|
1223
1223
|
dependencies = [
|
|
1224
1224
|
"anyhow",
|
|
1225
1225
|
"indoc",
|
|
@@ -1235,18 +1235,18 @@ dependencies = [
|
|
|
1235
1235
|
|
|
1236
1236
|
[[package]]
|
|
1237
1237
|
name = "pyo3-build-config"
|
|
1238
|
-
version = "0.27.
|
|
1238
|
+
version = "0.27.2"
|
|
1239
1239
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1240
|
-
checksum = "
|
|
1240
|
+
checksum = "b455933107de8642b4487ed26d912c2d899dec6114884214a0b3bb3be9261ea6"
|
|
1241
1241
|
dependencies = [
|
|
1242
1242
|
"target-lexicon",
|
|
1243
1243
|
]
|
|
1244
1244
|
|
|
1245
1245
|
[[package]]
|
|
1246
1246
|
name = "pyo3-ffi"
|
|
1247
|
-
version = "0.27.
|
|
1247
|
+
version = "0.27.2"
|
|
1248
1248
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1249
|
-
checksum = "
|
|
1249
|
+
checksum = "1c85c9cbfaddf651b1221594209aed57e9e5cff63c4d11d1feead529b872a089"
|
|
1250
1250
|
dependencies = [
|
|
1251
1251
|
"libc",
|
|
1252
1252
|
"pyo3-build-config",
|
|
@@ -1254,9 +1254,9 @@ dependencies = [
|
|
|
1254
1254
|
|
|
1255
1255
|
[[package]]
|
|
1256
1256
|
name = "pyo3-macros"
|
|
1257
|
-
version = "0.27.
|
|
1257
|
+
version = "0.27.2"
|
|
1258
1258
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1259
|
-
checksum = "
|
|
1259
|
+
checksum = "0a5b10c9bf9888125d917fb4d2ca2d25c8df94c7ab5a52e13313a07e050a3b02"
|
|
1260
1260
|
dependencies = [
|
|
1261
1261
|
"proc-macro2",
|
|
1262
1262
|
"pyo3-macros-backend",
|
|
@@ -1266,9 +1266,9 @@ dependencies = [
|
|
|
1266
1266
|
|
|
1267
1267
|
[[package]]
|
|
1268
1268
|
name = "pyo3-macros-backend"
|
|
1269
|
-
version = "0.27.
|
|
1269
|
+
version = "0.27.2"
|
|
1270
1270
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1271
|
-
checksum = "
|
|
1271
|
+
checksum = "03b51720d314836e53327f5871d4c0cfb4fb37cc2c4a11cc71907a86342c40f9"
|
|
1272
1272
|
dependencies = [
|
|
1273
1273
|
"heck",
|
|
1274
1274
|
"proc-macro2",
|
|
@@ -1368,9 +1368,9 @@ checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
|
|
1368
1368
|
|
|
1369
1369
|
[[package]]
|
|
1370
1370
|
name = "rustix"
|
|
1371
|
-
version = "1.
|
|
1371
|
+
version = "1.1.3"
|
|
1372
1372
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1373
|
-
checksum = "
|
|
1373
|
+
checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34"
|
|
1374
1374
|
dependencies = [
|
|
1375
1375
|
"bitflags",
|
|
1376
1376
|
"errno",
|
|
@@ -1423,9 +1423,9 @@ dependencies = [
|
|
|
1423
1423
|
|
|
1424
1424
|
[[package]]
|
|
1425
1425
|
name = "schemars"
|
|
1426
|
-
version = "1.
|
|
1426
|
+
version = "1.2.0"
|
|
1427
1427
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1428
|
-
checksum = "
|
|
1428
|
+
checksum = "54e910108742c57a770f492731f99be216a52fadd361b06c8fb59d74ccc267d2"
|
|
1429
1429
|
dependencies = [
|
|
1430
1430
|
"dyn-clone",
|
|
1431
1431
|
"ref-cast",
|
|
@@ -1436,9 +1436,9 @@ dependencies = [
|
|
|
1436
1436
|
|
|
1437
1437
|
[[package]]
|
|
1438
1438
|
name = "schemars_derive"
|
|
1439
|
-
version = "1.
|
|
1439
|
+
version = "1.2.0"
|
|
1440
1440
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1441
|
-
checksum = "
|
|
1441
|
+
checksum = "4908ad288c5035a8eb12cfdf0d49270def0a268ee162b75eeee0f85d155a7c45"
|
|
1442
1442
|
dependencies = [
|
|
1443
1443
|
"proc-macro2",
|
|
1444
1444
|
"quote",
|
|
@@ -1521,16 +1521,16 @@ dependencies = [
|
|
|
1521
1521
|
|
|
1522
1522
|
[[package]]
|
|
1523
1523
|
name = "serde_json"
|
|
1524
|
-
version = "1.0.
|
|
1524
|
+
version = "1.0.148"
|
|
1525
1525
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1526
|
-
checksum = "
|
|
1526
|
+
checksum = "3084b546a1dd6289475996f182a22aba973866ea8e8b02c51d9f46b1336a22da"
|
|
1527
1527
|
dependencies = [
|
|
1528
1528
|
"indexmap",
|
|
1529
1529
|
"itoa",
|
|
1530
1530
|
"memchr",
|
|
1531
|
-
"ryu",
|
|
1532
1531
|
"serde",
|
|
1533
1532
|
"serde_core",
|
|
1533
|
+
"zmij",
|
|
1534
1534
|
]
|
|
1535
1535
|
|
|
1536
1536
|
[[package]]
|
|
@@ -1681,9 +1681,9 @@ checksum = "591ef38edfb78ca4771ee32cf494cb8771944bee237a9b91fc9c1424ac4b777b"
|
|
|
1681
1681
|
|
|
1682
1682
|
[[package]]
|
|
1683
1683
|
name = "tempfile"
|
|
1684
|
-
version = "3.
|
|
1684
|
+
version = "3.24.0"
|
|
1685
1685
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1686
|
-
checksum = "
|
|
1686
|
+
checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c"
|
|
1687
1687
|
dependencies = [
|
|
1688
1688
|
"fastrand",
|
|
1689
1689
|
"getrandom",
|
|
@@ -1787,9 +1787,9 @@ dependencies = [
|
|
|
1787
1787
|
|
|
1788
1788
|
[[package]]
|
|
1789
1789
|
name = "tokio"
|
|
1790
|
-
version = "1.
|
|
1790
|
+
version = "1.49.0"
|
|
1791
1791
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1792
|
-
checksum = "
|
|
1792
|
+
checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86"
|
|
1793
1793
|
dependencies = [
|
|
1794
1794
|
"bytes",
|
|
1795
1795
|
"pin-project-lite",
|
|
@@ -1809,9 +1809,9 @@ dependencies = [
|
|
|
1809
1809
|
|
|
1810
1810
|
[[package]]
|
|
1811
1811
|
name = "tokio-stream"
|
|
1812
|
-
version = "0.1.
|
|
1812
|
+
version = "0.1.18"
|
|
1813
1813
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1814
|
-
checksum = "
|
|
1814
|
+
checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70"
|
|
1815
1815
|
dependencies = [
|
|
1816
1816
|
"futures-core",
|
|
1817
1817
|
"pin-project-lite",
|
|
@@ -1820,9 +1820,9 @@ dependencies = [
|
|
|
1820
1820
|
|
|
1821
1821
|
[[package]]
|
|
1822
1822
|
name = "tokio-util"
|
|
1823
|
-
version = "0.7.
|
|
1823
|
+
version = "0.7.18"
|
|
1824
1824
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1825
|
-
checksum = "
|
|
1825
|
+
checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098"
|
|
1826
1826
|
dependencies = [
|
|
1827
1827
|
"bytes",
|
|
1828
1828
|
"futures-core",
|
|
@@ -1833,18 +1833,18 @@ dependencies = [
|
|
|
1833
1833
|
|
|
1834
1834
|
[[package]]
|
|
1835
1835
|
name = "toml_datetime"
|
|
1836
|
-
version = "0.7.
|
|
1836
|
+
version = "0.7.5+spec-1.1.0"
|
|
1837
1837
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1838
|
-
checksum = "
|
|
1838
|
+
checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347"
|
|
1839
1839
|
dependencies = [
|
|
1840
1840
|
"serde_core",
|
|
1841
1841
|
]
|
|
1842
1842
|
|
|
1843
1843
|
[[package]]
|
|
1844
1844
|
name = "toml_edit"
|
|
1845
|
-
version = "0.
|
|
1845
|
+
version = "0.24.0+spec-1.1.0"
|
|
1846
1846
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1847
|
-
checksum = "
|
|
1847
|
+
checksum = "8c740b185920170a6d9191122cafef7010bd6270a3824594bff6784c04d7f09e"
|
|
1848
1848
|
dependencies = [
|
|
1849
1849
|
"indexmap",
|
|
1850
1850
|
"toml_datetime",
|
|
@@ -1855,18 +1855,18 @@ dependencies = [
|
|
|
1855
1855
|
|
|
1856
1856
|
[[package]]
|
|
1857
1857
|
name = "toml_parser"
|
|
1858
|
-
version = "1.0.
|
|
1858
|
+
version = "1.0.6+spec-1.1.0"
|
|
1859
1859
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1860
|
-
checksum = "
|
|
1860
|
+
checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44"
|
|
1861
1861
|
dependencies = [
|
|
1862
1862
|
"winnow",
|
|
1863
1863
|
]
|
|
1864
1864
|
|
|
1865
1865
|
[[package]]
|
|
1866
1866
|
name = "toml_writer"
|
|
1867
|
-
version = "1.0.
|
|
1867
|
+
version = "1.0.6+spec-1.1.0"
|
|
1868
1868
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1869
|
-
checksum = "
|
|
1869
|
+
checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607"
|
|
1870
1870
|
|
|
1871
1871
|
[[package]]
|
|
1872
1872
|
name = "tower"
|
|
@@ -2107,9 +2107,9 @@ checksum = "c4013970217383f67b18aef68f6fb2e8d409bc5755227092d32efb0422ba24b8"
|
|
|
2107
2107
|
|
|
2108
2108
|
[[package]]
|
|
2109
2109
|
name = "tree-sitter-lua"
|
|
2110
|
-
version = "0.
|
|
2110
|
+
version = "0.4.1"
|
|
2111
2111
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2112
|
-
checksum = "
|
|
2112
|
+
checksum = "ea992f4164d83f371ef1239ae178c4d4596c296c09055e9a48bb02a2760403af"
|
|
2113
2113
|
dependencies = [
|
|
2114
2114
|
"cc",
|
|
2115
2115
|
"tree-sitter-language",
|
|
@@ -2480,3 +2480,9 @@ dependencies = [
|
|
|
2480
2480
|
"nix",
|
|
2481
2481
|
"thiserror 1.0.69",
|
|
2482
2482
|
]
|
|
2483
|
+
|
|
2484
|
+
[[package]]
|
|
2485
|
+
name = "zmij"
|
|
2486
|
+
version = "1.0.10"
|
|
2487
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2488
|
+
checksum = "30e0d8dffbae3d840f64bda38e28391faef673a7b5a6017840f2a106c8145868"
|
|
@@ -7,7 +7,7 @@ resolver = "2"
|
|
|
7
7
|
lto = true
|
|
8
8
|
|
|
9
9
|
[workspace.package]
|
|
10
|
-
version = "0.40.
|
|
10
|
+
version = "0.40.4"
|
|
11
11
|
authors = ["Herrington Darkholme <2883231+HerringtonDarkholme@users.noreply.github.com>"]
|
|
12
12
|
edition = "2021"
|
|
13
13
|
license = "MIT"
|
|
@@ -18,11 +18,11 @@ rust-version = "1.79"
|
|
|
18
18
|
readme = "README.md"
|
|
19
19
|
|
|
20
20
|
[workspace.dependencies]
|
|
21
|
-
ast-grep-core = { path = "crates/core", version = "0.40.
|
|
22
|
-
ast-grep-config = { path = "crates/config", version = "0.40.
|
|
23
|
-
ast-grep-dynamic = { path = "crates/dynamic", version = "0.40.
|
|
24
|
-
ast-grep-language = { path = "crates/language", version = "0.40.
|
|
25
|
-
ast-grep-lsp = { path = "crates/lsp", version = "0.40.
|
|
21
|
+
ast-grep-core = { path = "crates/core", version = "0.40.4", default-features = false }
|
|
22
|
+
ast-grep-config = { path = "crates/config", version = "0.40.4" }
|
|
23
|
+
ast-grep-dynamic = { path = "crates/dynamic", version = "0.40.4" }
|
|
24
|
+
ast-grep-language = { path = "crates/language", version = "0.40.4" }
|
|
25
|
+
ast-grep-lsp = { path = "crates/lsp", version = "0.40.4" }
|
|
26
26
|
|
|
27
27
|
bit-set = { version = "0.8.0" }
|
|
28
28
|
ignore = { version = "0.4.22" }
|
|
@@ -231,6 +231,7 @@ mod test_cli {
|
|
|
231
231
|
ok("run -p test --globs '*.js' --globs '*.ts'");
|
|
232
232
|
ok("run -p fubuki -j8");
|
|
233
233
|
ok("run -p test --threads 12");
|
|
234
|
+
ok("run -p test --files-with-matches");
|
|
234
235
|
ok("run -p test -l rs -c config.yml"); // global config arg
|
|
235
236
|
error("run test");
|
|
236
237
|
error("run --debug-query test"); // missing lang
|
|
@@ -242,6 +243,8 @@ mod test_cli {
|
|
|
242
243
|
error("run -p test -l rs --debug-query=not");
|
|
243
244
|
error("run -p test --selector");
|
|
244
245
|
error("run -p test --threads");
|
|
246
|
+
error("run -p test --files-with-matches -r test -U");
|
|
247
|
+
error("run -p test --files-with-matches --json");
|
|
245
248
|
}
|
|
246
249
|
|
|
247
250
|
#[test]
|
|
@@ -278,6 +281,8 @@ mod test_cli {
|
|
|
278
281
|
error("scan -j");
|
|
279
282
|
error("scan --include-metadata"); // requires json
|
|
280
283
|
error("scan --threads");
|
|
284
|
+
error("scan --files-with-matches -U");
|
|
285
|
+
error("scan --files-with-matches --json");
|
|
281
286
|
}
|
|
282
287
|
|
|
283
288
|
#[test]
|
|
@@ -21,8 +21,8 @@ mod test;
|
|
|
21
21
|
|
|
22
22
|
use markdown::Markdown;
|
|
23
23
|
use match_merger::MatchMerger;
|
|
24
|
-
|
|
25
|
-
use styles::{
|
|
24
|
+
use styles::RuleStyle;
|
|
25
|
+
pub use styles::{should_use_color, PrintStyles};
|
|
26
26
|
|
|
27
27
|
#[derive(Clone, Copy, ValueEnum)]
|
|
28
28
|
pub enum ReportStyle {
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
use super::{Diff, NodeMatch, PrintProcessor, Printer};
|
|
2
|
+
use crate::lang::SgLang;
|
|
3
|
+
use anyhow::Result;
|
|
4
|
+
use ast_grep_config::RuleConfig;
|
|
5
|
+
use codespan_reporting::files::SimpleFile;
|
|
6
|
+
use codespan_reporting::term::termcolor::{Buffer, ColorChoice, StandardStream, WriteColor};
|
|
7
|
+
|
|
8
|
+
use std::borrow::Cow;
|
|
9
|
+
use std::path::Path;
|
|
10
|
+
|
|
11
|
+
use super::PrintStyles;
|
|
12
|
+
|
|
13
|
+
pub struct FileNamePrinter<W: WriteColor> {
|
|
14
|
+
writer: W,
|
|
15
|
+
styles: PrintStyles,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
impl<W: WriteColor> FileNamePrinter<W> {
|
|
19
|
+
pub fn new(writer: W) -> Self {
|
|
20
|
+
Self {
|
|
21
|
+
writer,
|
|
22
|
+
styles: PrintStyles::from(ColorChoice::Auto),
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
pub fn color<C: Into<ColorChoice>>(mut self, color: C) -> Self {
|
|
27
|
+
let color = color.into();
|
|
28
|
+
self.styles = PrintStyles::from(color);
|
|
29
|
+
self
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
impl<W: WriteColor> Printer for FileNamePrinter<W> {
|
|
34
|
+
type Processed = Buffer;
|
|
35
|
+
type Processor = FileNameProcessor;
|
|
36
|
+
|
|
37
|
+
fn get_processor(&self) -> Self::Processor {
|
|
38
|
+
let color = self.writer.supports_color();
|
|
39
|
+
FileNameProcessor {
|
|
40
|
+
color,
|
|
41
|
+
styles: self.styles.clone(),
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
fn process(&mut self, buffer: Buffer) -> Result<()> {
|
|
46
|
+
self.writer.write_all(buffer.as_slice())?;
|
|
47
|
+
Ok(())
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
impl FileNamePrinter<StandardStream> {
|
|
52
|
+
pub fn stdout<C: Into<ColorChoice>>(color: C) -> Self {
|
|
53
|
+
let color = color.into();
|
|
54
|
+
FileNamePrinter::new(StandardStream::stdout(color)).color(color)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
fn create_buffer(color: bool) -> Buffer {
|
|
59
|
+
if color {
|
|
60
|
+
Buffer::ansi()
|
|
61
|
+
} else {
|
|
62
|
+
Buffer::no_color()
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
pub struct FileNameProcessor {
|
|
67
|
+
color: bool,
|
|
68
|
+
styles: PrintStyles,
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
impl FileNameProcessor {
|
|
72
|
+
fn print_path(&self, path: &Path) -> Result<Buffer> {
|
|
73
|
+
let styles = &self.styles;
|
|
74
|
+
let mut buffer = create_buffer(self.color);
|
|
75
|
+
styles.print_prelude(path, &mut buffer)?;
|
|
76
|
+
Ok(buffer)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
impl PrintProcessor<Buffer> for FileNameProcessor {
|
|
81
|
+
fn print_rule(
|
|
82
|
+
&self,
|
|
83
|
+
_matches: Vec<NodeMatch>,
|
|
84
|
+
file: SimpleFile<Cow<str>, &str>,
|
|
85
|
+
_rule: &RuleConfig<SgLang>,
|
|
86
|
+
) -> Result<Buffer> {
|
|
87
|
+
let path = Path::new(file.name().as_ref());
|
|
88
|
+
self.print_path(path)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
fn print_matches(&self, _matches: Vec<NodeMatch>, path: &Path) -> Result<Buffer> {
|
|
92
|
+
self.print_path(path)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
fn print_diffs(&self, _diffs: Vec<Diff>, path: &Path) -> Result<Buffer> {
|
|
96
|
+
self.print_path(path)
|
|
97
|
+
}
|
|
98
|
+
fn print_rule_diffs(
|
|
99
|
+
&self,
|
|
100
|
+
_diffs: Vec<(Diff<'_>, &RuleConfig<SgLang>)>,
|
|
101
|
+
path: &Path,
|
|
102
|
+
) -> Result<Buffer> {
|
|
103
|
+
self.print_path(path)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
mod cloud_print;
|
|
2
2
|
mod colored_print;
|
|
3
|
+
mod file_name_printer;
|
|
3
4
|
mod interactive_print;
|
|
4
5
|
mod json_print;
|
|
5
6
|
|
|
@@ -16,7 +17,9 @@ use std::path::Path;
|
|
|
16
17
|
pub use cloud_print::{CloudPrinter, Platform};
|
|
17
18
|
pub use codespan_reporting::files::SimpleFile;
|
|
18
19
|
use codespan_reporting::term::termcolor::ColorChoice;
|
|
20
|
+
use colored_print::PrintStyles;
|
|
19
21
|
pub use colored_print::{ColoredPrinter, Heading, ReportStyle};
|
|
22
|
+
pub use file_name_printer::FileNamePrinter;
|
|
20
23
|
pub use interactive_print::InteractivePrinter;
|
|
21
24
|
pub use json_print::{JSONPrinter, JsonStyle};
|
|
22
25
|
|
|
@@ -11,7 +11,8 @@ use ignore::WalkParallel;
|
|
|
11
11
|
use crate::config::ProjectConfig;
|
|
12
12
|
use crate::lang::SgLang;
|
|
13
13
|
use crate::print::{
|
|
14
|
-
ColoredPrinter, Diff, Heading, InteractivePrinter, JSONPrinter, PrintProcessor,
|
|
14
|
+
ColoredPrinter, Diff, FileNamePrinter, Heading, InteractivePrinter, JSONPrinter, PrintProcessor,
|
|
15
|
+
Printer,
|
|
15
16
|
};
|
|
16
17
|
use crate::utils::ErrorContext as EC;
|
|
17
18
|
use crate::utils::{filter_file_pattern, ContextArgs, InputArgs, MatchUnit, OutputArgs};
|
|
@@ -151,6 +152,10 @@ pub fn run_with_pattern(arg: RunArg, project: Result<ProjectConfig>) -> Result<E
|
|
|
151
152
|
let proj = arg.output.inspect.project_trace();
|
|
152
153
|
proj.print_project(&project)?;
|
|
153
154
|
let context = arg.context.get();
|
|
155
|
+
if arg.output.files_with_matches {
|
|
156
|
+
let printer = FileNamePrinter::stdout(arg.output.color);
|
|
157
|
+
return run_pattern_with_printer(arg, printer);
|
|
158
|
+
}
|
|
154
159
|
if let Some(json) = arg.output.json {
|
|
155
160
|
let printer = JSONPrinter::stdout(json).context(context);
|
|
156
161
|
return run_pattern_with_printer(arg, printer);
|
|
@@ -415,6 +420,7 @@ mod test {
|
|
|
415
420
|
color: ColorArg::Never,
|
|
416
421
|
interactive: false,
|
|
417
422
|
json: None,
|
|
423
|
+
files_with_matches: false,
|
|
418
424
|
update_all: false,
|
|
419
425
|
inspect: Default::default(),
|
|
420
426
|
},
|
|
@@ -11,8 +11,8 @@ use ignore::WalkParallel;
|
|
|
11
11
|
use crate::config::{read_rule_file, with_rule_stats, ProjectConfig};
|
|
12
12
|
use crate::lang::SgLang;
|
|
13
13
|
use crate::print::{
|
|
14
|
-
CloudPrinter, ColoredPrinter, Diff, InteractivePrinter, JSONPrinter, Platform,
|
|
15
|
-
Printer, ReportStyle, SimpleFile,
|
|
14
|
+
CloudPrinter, ColoredPrinter, Diff, FileNamePrinter, InteractivePrinter, JSONPrinter, Platform,
|
|
15
|
+
PrintProcessor, Printer, ReportStyle, SimpleFile,
|
|
16
16
|
};
|
|
17
17
|
use crate::utils::ErrorContext as EC;
|
|
18
18
|
use crate::utils::RuleOverwrite;
|
|
@@ -80,6 +80,10 @@ pub fn run_with_config(arg: ScanArg, project: Result<ProjectConfig>) -> Result<E
|
|
|
80
80
|
let project_trace = arg.output.inspect.project_trace();
|
|
81
81
|
project_trace.print_project(&project)?;
|
|
82
82
|
let context = arg.context.get();
|
|
83
|
+
if arg.output.files_with_matches {
|
|
84
|
+
let printer = FileNamePrinter::stdout(arg.output.color);
|
|
85
|
+
return run_scan(arg, printer, project);
|
|
86
|
+
}
|
|
83
87
|
if let Some(format) = &arg.format {
|
|
84
88
|
let printer = CloudPrinter::stdout(format.clone());
|
|
85
89
|
return run_scan(arg, printer, project);
|
|
@@ -411,6 +415,7 @@ rule:
|
|
|
411
415
|
output: OutputArgs {
|
|
412
416
|
interactive: false,
|
|
413
417
|
json: None,
|
|
418
|
+
files_with_matches: false,
|
|
414
419
|
update_all: false,
|
|
415
420
|
color: ColorArg::Never,
|
|
416
421
|
inspect: Default::default(),
|
|
@@ -126,6 +126,15 @@ pub struct OutputArgs {
|
|
|
126
126
|
#[clap(short = 'U', long)]
|
|
127
127
|
pub update_all: bool,
|
|
128
128
|
|
|
129
|
+
/// Print only the paths with at least one match and suppress match contents.
|
|
130
|
+
///
|
|
131
|
+
/// It conflicts with both the --interactive, --json and --update-all flags.
|
|
132
|
+
#[clap(
|
|
133
|
+
long,
|
|
134
|
+
conflicts_with_all = ["interactive", "json", "update_all"],
|
|
135
|
+
)]
|
|
136
|
+
pub files_with_matches: bool,
|
|
137
|
+
|
|
129
138
|
/// Output matches in structured JSON.
|
|
130
139
|
///
|
|
131
140
|
/// If this flag is set, ast-grep will output matches in JSON format.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
mod common;
|
|
2
2
|
|
|
3
3
|
use anyhow::Result;
|
|
4
|
-
use assert_cmd::Command;
|
|
4
|
+
use assert_cmd::{cargo_bin, Command};
|
|
5
5
|
use common::create_test_files;
|
|
6
6
|
use predicates::str::contains;
|
|
7
7
|
|
|
8
8
|
#[test]
|
|
9
9
|
fn test_help_work_for_invalid_sgconfig() -> Result<()> {
|
|
10
10
|
let dir = create_test_files([("sgconfig.yml", "invalid")])?;
|
|
11
|
-
Command::cargo_bin(
|
|
11
|
+
Command::new(cargo_bin!())
|
|
12
12
|
.current_dir(dir.path())
|
|
13
13
|
.args(["help"])
|
|
14
14
|
.assert()
|