ast-grep-cli 0.7.2__tar.gz → 0.9.0__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.
Files changed (71) hide show
  1. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/PKG-INFO +1 -1
  2. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/Cargo.lock +29 -45
  3. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/Cargo.toml +3 -3
  4. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/src/lib.rs +14 -0
  5. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/src/print/colored_print.rs +5 -5
  6. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/src/run.rs +14 -14
  7. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/src/scan.rs +12 -12
  8. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/src/verify.rs +10 -8
  9. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/tests/run_test.rs +0 -2
  10. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/tests/scan_test.rs +1 -2
  11. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-config/Cargo.toml +2 -2
  12. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/Cargo.toml +1 -1
  13. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-dynamic/Cargo.toml +1 -1
  14. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-language/Cargo.toml +1 -1
  15. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-lsp/Cargo.toml +2 -2
  16. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/pyproject.toml +1 -1
  17. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/LICENSE +0 -0
  18. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/README.md +0 -0
  19. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/src/bin/ast-grep.rs +0 -0
  20. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/src/config.rs +0 -0
  21. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/src/error.rs +0 -0
  22. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/src/lang.rs +0 -0
  23. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/src/lsp.rs +0 -0
  24. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/src/main.rs +0 -0
  25. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/src/new.rs +0 -0
  26. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/src/print/interactive_print.rs +0 -0
  27. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/src/print/json_print.rs +0 -0
  28. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/src/print/mod.rs +0 -0
  29. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/src/utils.rs +0 -0
  30. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/tests/common/mod.rs +0 -0
  31. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/crates/cli/tests/verify_test.rs +0 -0
  32. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-config/src/constraints.rs +0 -0
  33. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-config/src/deserialize_env.rs +0 -0
  34. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-config/src/lib.rs +0 -0
  35. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-config/src/maybe.rs +0 -0
  36. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-config/src/referent_rule.rs +0 -0
  37. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-config/src/relational_rule/mod.rs +0 -0
  38. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-config/src/relational_rule/stop_by.rs +0 -0
  39. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-config/src/rule.rs +0 -0
  40. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-config/src/rule_collection.rs +0 -0
  41. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-config/src/rule_config.rs +0 -0
  42. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-config/src/transform.rs +0 -0
  43. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/language.rs +0 -0
  44. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/lib.rs +0 -0
  45. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/match_tree.rs +0 -0
  46. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/matcher/kind.rs +0 -0
  47. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/matcher/node_match.rs +0 -0
  48. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/matcher/pattern.rs +0 -0
  49. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/matcher/text.rs +0 -0
  50. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/matcher.rs +0 -0
  51. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/meta_var.rs +0 -0
  52. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/node.rs +0 -0
  53. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/ops.rs +0 -0
  54. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/pinned.rs +0 -0
  55. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/replacer/indent.rs +0 -0
  56. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/replacer/structural.rs +0 -0
  57. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/replacer/template.rs +0 -0
  58. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/replacer.rs +0 -0
  59. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/source.rs +0 -0
  60. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-core/src/traversal.rs +0 -0
  61. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-dynamic/src/lib.rs +0 -0
  62. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-language/src/cpp.rs +0 -0
  63. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-language/src/csharp.rs +0 -0
  64. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-language/src/css.rs +0 -0
  65. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-language/src/go.rs +0 -0
  66. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-language/src/lib.rs +0 -0
  67. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-language/src/parsers.rs +0 -0
  68. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-language/src/python.rs +0 -0
  69. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-language/src/rust.rs +0 -0
  70. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-language/src/scala.rs +0 -0
  71. {ast_grep_cli-0.7.2 → ast_grep_cli-0.9.0}/local_dependencies/ast-grep-lsp/src/lib.rs +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ast-grep-cli
3
- Version: 0.7.2
3
+ Version: 0.9.0
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Environment :: Console
6
6
  Classifier: Intended Audience :: Developers
@@ -4,18 +4,9 @@ version = 3
4
4
 
5
5
  [[package]]
6
6
  name = "aho-corasick"
7
- version = "0.7.18"
7
+ version = "1.0.2"
8
8
  source = "registry+https://github.com/rust-lang/crates.io-index"
9
- checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
10
- dependencies = [
11
- "memchr",
12
- ]
13
-
14
- [[package]]
15
- name = "aho-corasick"
16
- version = "1.0.1"
17
- source = "registry+https://github.com/rust-lang/crates.io-index"
18
- checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04"
9
+ checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41"
19
10
  dependencies = [
20
11
  "memchr",
21
12
  ]
@@ -92,9 +83,9 @@ checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602"
92
83
 
93
84
  [[package]]
94
85
  name = "assert_cmd"
95
- version = "2.0.11"
86
+ version = "2.0.12"
96
87
  source = "registry+https://github.com/rust-lang/crates.io-index"
97
- checksum = "86d6b683edf8d1119fe420a94f8a7e389239666aa72e65495d91c00462510151"
88
+ checksum = "88903cb14723e4d4003335bb7f8a14f27691649105346a0f0957466c096adfe6"
98
89
  dependencies = [
99
90
  "anstyle",
100
91
  "bstr",
@@ -107,7 +98,7 @@ dependencies = [
107
98
 
108
99
  [[package]]
109
100
  name = "ast-grep"
110
- version = "0.7.2"
101
+ version = "0.9.0"
111
102
  dependencies = [
112
103
  "ansi_term",
113
104
  "anyhow",
@@ -135,7 +126,7 @@ dependencies = [
135
126
 
136
127
  [[package]]
137
128
  name = "ast-grep-config"
138
- version = "0.7.2"
129
+ version = "0.9.0"
139
130
  dependencies = [
140
131
  "anyhow",
141
132
  "ast-grep-core",
@@ -151,7 +142,7 @@ dependencies = [
151
142
 
152
143
  [[package]]
153
144
  name = "ast-grep-core"
154
- version = "0.7.2"
145
+ version = "0.9.0"
155
146
  dependencies = [
156
147
  "bit-set",
157
148
  "regex",
@@ -162,7 +153,7 @@ dependencies = [
162
153
 
163
154
  [[package]]
164
155
  name = "ast-grep-dynamic"
165
- version = "0.7.2"
156
+ version = "0.9.0"
166
157
  dependencies = [
167
158
  "ast-grep-core",
168
159
  "ignore",
@@ -174,7 +165,7 @@ dependencies = [
174
165
 
175
166
  [[package]]
176
167
  name = "ast-grep-language"
177
- version = "0.7.2"
168
+ version = "0.9.0"
178
169
  dependencies = [
179
170
  "ast-grep-core",
180
171
  "ast-grep-tree-sitter-c-sharp",
@@ -200,7 +191,7 @@ dependencies = [
200
191
 
201
192
  [[package]]
202
193
  name = "ast-grep-lsp"
203
- version = "0.7.2"
194
+ version = "0.9.0"
204
195
  dependencies = [
205
196
  "ast-grep-config",
206
197
  "ast-grep-core",
@@ -212,7 +203,7 @@ dependencies = [
212
203
 
213
204
  [[package]]
214
205
  name = "ast-grep-napi"
215
- version = "0.7.2"
206
+ version = "0.9.0"
216
207
  dependencies = [
217
208
  "ast-grep-config",
218
209
  "ast-grep-core",
@@ -281,7 +272,7 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
281
272
 
282
273
  [[package]]
283
274
  name = "benches"
284
- version = "0.7.2"
275
+ version = "0.9.0"
285
276
  dependencies = [
286
277
  "ast-grep-config",
287
278
  "ast-grep-core",
@@ -318,13 +309,12 @@ checksum = "d5dd14596c0e5b954530d0e6f1fd99b89c03e313aa2086e8da4303701a09e1cf"
318
309
 
319
310
  [[package]]
320
311
  name = "bstr"
321
- version = "1.1.0"
312
+ version = "1.6.0"
322
313
  source = "registry+https://github.com/rust-lang/crates.io-index"
323
- checksum = "b45ea9b00a7b3f2988e9a65ad3917e62123c38dba709b666506207be96d1790b"
314
+ checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05"
324
315
  dependencies = [
325
316
  "memchr",
326
- "once_cell",
327
- "regex-automata 0.1.10",
317
+ "regex-automata",
328
318
  "serde",
329
319
  ]
330
320
 
@@ -387,9 +377,9 @@ dependencies = [
387
377
 
388
378
  [[package]]
389
379
  name = "clap"
390
- version = "4.3.11"
380
+ version = "4.3.12"
391
381
  source = "registry+https://github.com/rust-lang/crates.io-index"
392
- checksum = "1640e5cc7fb47dbb8338fd471b105e7ed6c3cb2aeb00c2e067127ffd3764a05d"
382
+ checksum = "3eab9e8ceb9afdade1ab3f0fd8dbce5b1b2f468ad653baf10e771781b2b67b73"
393
383
  dependencies = [
394
384
  "clap_builder",
395
385
  "clap_derive",
@@ -398,9 +388,9 @@ dependencies = [
398
388
 
399
389
  [[package]]
400
390
  name = "clap_builder"
401
- version = "4.3.11"
391
+ version = "4.3.12"
402
392
  source = "registry+https://github.com/rust-lang/crates.io-index"
403
- checksum = "98c59138d527eeaf9b53f35a77fcc1fad9d883116070c63d5de1c7dc7b00c72b"
393
+ checksum = "9f2763db829349bf00cfc06251268865ed4363b93a943174f638daf3ecdba2cd"
404
394
  dependencies = [
405
395
  "anstream",
406
396
  "anstyle",
@@ -410,9 +400,9 @@ dependencies = [
410
400
 
411
401
  [[package]]
412
402
  name = "clap_derive"
413
- version = "4.3.2"
403
+ version = "4.3.12"
414
404
  source = "registry+https://github.com/rust-lang/crates.io-index"
415
- checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f"
405
+ checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050"
416
406
  dependencies = [
417
407
  "heck",
418
408
  "proc-macro2",
@@ -755,11 +745,11 @@ dependencies = [
755
745
 
756
746
  [[package]]
757
747
  name = "globset"
758
- version = "0.4.10"
748
+ version = "0.4.11"
759
749
  source = "registry+https://github.com/rust-lang/crates.io-index"
760
- checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc"
750
+ checksum = "1391ab1f92ffcc08911957149833e682aa3fe252b9f45f966d2ef972274c97df"
761
751
  dependencies = [
762
- "aho-corasick 0.7.18",
752
+ "aho-corasick",
763
753
  "bstr",
764
754
  "fnv",
765
755
  "log",
@@ -1356,25 +1346,19 @@ version = "1.9.1"
1356
1346
  source = "registry+https://github.com/rust-lang/crates.io-index"
1357
1347
  checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575"
1358
1348
  dependencies = [
1359
- "aho-corasick 1.0.1",
1349
+ "aho-corasick",
1360
1350
  "memchr",
1361
- "regex-automata 0.3.2",
1351
+ "regex-automata",
1362
1352
  "regex-syntax",
1363
1353
  ]
1364
1354
 
1365
- [[package]]
1366
- name = "regex-automata"
1367
- version = "0.1.10"
1368
- source = "registry+https://github.com/rust-lang/crates.io-index"
1369
- checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
1370
-
1371
1355
  [[package]]
1372
1356
  name = "regex-automata"
1373
1357
  version = "0.3.2"
1374
1358
  source = "registry+https://github.com/rust-lang/crates.io-index"
1375
1359
  checksum = "83d3daa6976cffb758ec878f108ba0e062a45b2d6ca3a2cca965338855476caf"
1376
1360
  dependencies = [
1377
- "aho-corasick 1.0.1",
1361
+ "aho-corasick",
1378
1362
  "memchr",
1379
1363
  "regex-syntax",
1380
1364
  ]
@@ -1457,9 +1441,9 @@ dependencies = [
1457
1441
 
1458
1442
  [[package]]
1459
1443
  name = "serde_json"
1460
- version = "1.0.100"
1444
+ version = "1.0.102"
1461
1445
  source = "registry+https://github.com/rust-lang/crates.io-index"
1462
- checksum = "0f1e14e89be7aa4c4b78bdbdc9eb5bf8517829a600ae8eaa39a6e1d960b5185c"
1446
+ checksum = "b5062a995d481b2308b6064e9af76011f2921c35f97b0468811ed9f6cd91dfed"
1463
1447
  dependencies = [
1464
1448
  "indexmap",
1465
1449
  "itoa",
@@ -8,7 +8,7 @@ default-run = "sg"
8
8
  readme = "../../README.md"
9
9
  license-file = "../../LICENSE"
10
10
 
11
- version= "0.7.2"
11
+ version= "0.9.0"
12
12
  authors= ["Herrington Darkholme <2883231+HerringtonDarkholme@users.noreply.github.com>"]
13
13
  edition= "2021"
14
14
  # license.workspace = true
@@ -35,14 +35,14 @@ ast-grep-lsp.path = "../../local_dependencies/ast-grep-lsp"
35
35
  ansi_term = "0.12"
36
36
  anyhow = "1.0"
37
37
  atty = "0.2.14"
38
- clap = { version = "4.3.11", features = ["derive"] }
38
+ clap = { version = "4.3.12", features = ["derive"] }
39
39
  codespan-reporting = "0.11.1"
40
40
  crossterm = "0.26.1"
41
41
  ignore= { version = "0.4.20" }
42
42
  inquire = "0.6.2"
43
43
  num_cpus = "1.16.0"
44
44
  serde= { version = "1.0", features = ["derive"] }
45
- serde_json = "1.0.100"
45
+ serde_json = "1.0.102"
46
46
  serde_yaml = "0.9.22"
47
47
  similar = { version = "2.2.1", features = ["inline"] }
48
48
  tokio = { version = "1", features = ["rt-multi-thread", "io-std"] }
@@ -156,11 +156,15 @@ mod test_cli {
156
156
  ok("run -p test -l rs --color always");
157
157
  ok("run -p test -l rs --heading always");
158
158
  ok("run -p test dir1 dir2 dir3"); // multiple paths
159
+ ok("run -p testm -r restm -U"); // update all
160
+ ok("run -p testm -r restm --update-all"); // update all
159
161
  error("run test");
160
162
  error("run --debug-query test"); // missing lang
161
163
  error("run -r Test dir");
162
164
  error("run -p test -i --json dir"); // conflict
163
165
  error("run -p test -l rs -c always"); // no color shortcut
166
+ error("run -p test -U");
167
+ error("run -p test --update-all");
164
168
  }
165
169
 
166
170
  #[test]
@@ -176,4 +180,14 @@ mod test_cli {
176
180
  error("scan --report-style rich --json dir"); // conflict
177
181
  error("scan -r test.yml -c test.yml --json dir"); // conflict
178
182
  }
183
+
184
+ #[test]
185
+ fn test_test() {
186
+ ok("test");
187
+ ok("test -c sgconfig.yml");
188
+ ok("test --skip-snapshot-tests");
189
+ ok("test -U");
190
+ ok("test --update-all");
191
+ error("test --update-all --skip-snapshot-tests");
192
+ }
179
193
  }
@@ -305,7 +305,7 @@ fn print_matches_with_heading<'a, W: Write>(
305
305
  let lines = ret.lines().count();
306
306
  let mut num = merger.last_start_line;
307
307
  let width = (lines + num).to_string().chars().count();
308
- write!(writer, "{num:>width$}")?; // initial line num
308
+ write!(writer, "{num:>width$}:")?; // initial line num
309
309
  print_highlight(ret.lines(), width, &mut num, writer)?;
310
310
  writeln!(writer)?; // end match new line
311
311
  //
@@ -317,7 +317,7 @@ fn print_matches_with_heading<'a, W: Write>(
317
317
  let lines = ret.lines().count();
318
318
  let mut num = merger.last_start_line;
319
319
  let width = (lines + num).to_string().chars().count();
320
- write!(writer, "{num:>width$}")?; // initial line num
320
+ write!(writer, "{num:>width$}:")?; // initial line num
321
321
  print_highlight(ret.lines(), width, &mut num, writer)?;
322
322
  writeln!(writer)?; // end match new line
323
323
  writeln!(writer)?; // end
@@ -409,7 +409,7 @@ fn print_highlight<'a, W: Write>(
409
409
  for line in lines {
410
410
  writeln!(writer)?;
411
411
  *num += 1;
412
- write!(writer, "{num:>width$}{line}")?;
412
+ write!(writer, "{num:>width$}:{line}")?;
413
413
  }
414
414
  Ok(())
415
415
  }
@@ -458,7 +458,7 @@ pub fn print_diff(
458
458
  };
459
459
  write!(
460
460
  writer,
461
- "{} {}{}",
461
+ "{} {}:{}",
462
462
  index_display(change.old_index(), s, old_width),
463
463
  index_display(change.new_index(), s, new_width),
464
464
  s.paint(sign),
@@ -693,7 +693,7 @@ mod test {
693
693
  let expected: String = source
694
694
  .lines()
695
695
  .enumerate()
696
- .map(|(i, l)| format!("{}{l}\n", i + 1))
696
+ .map(|(i, l)| format!("{}:{l}\n", i + 1))
697
697
  .collect();
698
698
  // append heading to expected
699
699
  let output = format!("test.tsx\n{expected}\n");
@@ -64,8 +64,8 @@ pub struct RunArg {
64
64
  paths: Vec<PathBuf>,
65
65
 
66
66
  /// Apply all rewrite without confirmation if true.
67
- #[clap(short = 'A', long)]
68
- accept_all: bool,
67
+ #[clap(short = 'U', long, requires = "rewrite")]
68
+ update_all: bool,
69
69
 
70
70
  /// Output matches in structured JSON text useful for tools like jq.
71
71
  /// Conflicts with interactive.
@@ -87,12 +87,12 @@ pub struct RunArg {
87
87
  #[clap(long, action = clap::ArgAction::Append)]
88
88
  no_ignore: Vec<IgnoreFile>,
89
89
 
90
- /// Disable search code from StdIn.
90
+ /// Enable search code from StdIn.
91
91
  ///
92
- /// Use this if you need search files but ast-grep is launched from another process.
93
- /// You can also use the environment variable `AST_GREP_NO_STDIN` to disable StdIn mode.
92
+ /// Use this if you need to take code stream from standard input.
93
+ /// If the environment variable `AST_GREP_NO_STDIN` exist, ast-grep will disable StdIn mode.
94
94
  #[clap(long)]
95
- no_stdin: bool,
95
+ stdin: bool,
96
96
  }
97
97
 
98
98
  // Every run will include Search or Replace
@@ -102,10 +102,10 @@ pub fn run_with_pattern(arg: RunArg) -> Result<()> {
102
102
  return run_pattern_with_printer(arg, JSONPrinter::stdout());
103
103
  }
104
104
  let printer = ColoredPrinter::stdout(arg.color).heading(arg.heading);
105
- let interactive = arg.interactive || arg.accept_all;
105
+ let interactive = arg.interactive || arg.update_all;
106
106
  if interactive {
107
- let from_stdin = !arg.no_stdin && is_from_stdin();
108
- let printer = InteractivePrinter::new(printer, arg.accept_all, from_stdin)?;
107
+ let from_stdin = arg.stdin && is_from_stdin();
108
+ let printer = InteractivePrinter::new(printer, arg.update_all, from_stdin)?;
109
109
  run_pattern_with_printer(arg, printer)
110
110
  } else {
111
111
  run_pattern_with_printer(arg, printer)
@@ -113,7 +113,7 @@ pub fn run_with_pattern(arg: RunArg) -> Result<()> {
113
113
  }
114
114
 
115
115
  fn run_pattern_with_printer(arg: RunArg, printer: impl Printer + Sync) -> Result<()> {
116
- if !arg.no_stdin && is_from_stdin() {
116
+ if arg.stdin && is_from_stdin() {
117
117
  run_std_in(RunWithSpecificLang::new(arg, printer)?)
118
118
  } else if arg.lang.is_some() {
119
119
  run_worker(RunWithSpecificLang::new(arg, printer)?)
@@ -270,13 +270,13 @@ mod test {
270
270
  rewrite: None,
271
271
  color: ColorArg::Never,
272
272
  no_ignore: vec![],
273
- no_stdin: true,
273
+ stdin: false,
274
274
  interactive: false,
275
275
  lang: None,
276
276
  json: false,
277
277
  heading: Heading::Never,
278
278
  debug_query: false,
279
- accept_all: false,
279
+ update_all: false,
280
280
  paths: vec![PathBuf::from(".")],
281
281
  };
282
282
  assert!(run_with_pattern(arg).is_ok())
@@ -294,8 +294,8 @@ mod test {
294
294
  json: false,
295
295
  heading: Heading::Never,
296
296
  debug_query: false,
297
- accept_all: false,
298
- no_stdin: false,
297
+ update_all: false,
298
+ stdin: true,
299
299
  paths: vec![PathBuf::from(".")],
300
300
  };
301
301
  assert!(run_with_pattern(arg).is_ok())
@@ -46,8 +46,8 @@ pub struct ScanArg {
46
46
  json: bool,
47
47
 
48
48
  /// Apply all rewrite without confirmation if true.
49
- #[clap(short = 'A', long)]
50
- accept_all: bool,
49
+ #[clap(short = 'U', long)]
50
+ update_all: bool,
51
51
 
52
52
  /// The paths to search. You can provide multiple paths separated by spaces.
53
53
  #[clap(value_parser, default_value = ".")]
@@ -57,12 +57,12 @@ pub struct ScanArg {
57
57
  #[clap(long, action = clap::ArgAction::Append)]
58
58
  no_ignore: Vec<IgnoreFile>,
59
59
 
60
- /// Disable search code from StdIn.
60
+ /// Enable search code from StdIn.
61
61
  ///
62
- /// Use this if you need search files but ast-grep is launched from another process.
63
- /// You can also use the environment variable `AST_GREP_NO_STDIN` to disable StdIn mode.
62
+ /// Use this if you need to take code stream from standard input.
63
+ /// If the environment variable `AST_GREP_NO_STDIN` exist, ast-grep will disable StdIn mode.
64
64
  #[clap(long)]
65
- no_stdin: bool,
65
+ stdin: bool,
66
66
  }
67
67
 
68
68
  pub fn run_with_config(arg: ScanArg) -> Result<()> {
@@ -72,10 +72,10 @@ pub fn run_with_config(arg: ScanArg) -> Result<()> {
72
72
  return run_scan(arg, printer);
73
73
  }
74
74
  let printer = ColoredPrinter::stdout(arg.color).style(arg.report_style);
75
- let interactive = arg.interactive || arg.accept_all;
75
+ let interactive = arg.interactive || arg.update_all;
76
76
  if interactive {
77
- let from_stdin = !arg.no_stdin && is_from_stdin();
78
- let printer = InteractivePrinter::new(printer, arg.accept_all, from_stdin)?;
77
+ let from_stdin = arg.stdin && is_from_stdin();
78
+ let printer = InteractivePrinter::new(printer, arg.update_all, from_stdin)?;
79
79
  run_scan(arg, printer)
80
80
  } else {
81
81
  run_scan(arg, printer)
@@ -83,7 +83,7 @@ pub fn run_with_config(arg: ScanArg) -> Result<()> {
83
83
  }
84
84
 
85
85
  fn run_scan<P: Printer + Sync>(arg: ScanArg, printer: P) -> Result<()> {
86
- if !arg.no_stdin && is_from_stdin() {
86
+ if arg.stdin && is_from_stdin() {
87
87
  let worker = ScanWithRule::try_new(arg, printer)?;
88
88
  run_std_in(worker)
89
89
  } else {
@@ -346,9 +346,9 @@ rule:
346
346
  no_ignore: vec![],
347
347
  interactive: false,
348
348
  json: false,
349
- accept_all: false,
349
+ update_all: false,
350
350
  paths: vec![PathBuf::from(".")],
351
- no_stdin: true,
351
+ stdin: false,
352
352
  };
353
353
  assert!(run_with_config(arg).is_ok());
354
354
  }
@@ -123,11 +123,13 @@ pub struct TestArg {
123
123
  snapshot_dir: Option<PathBuf>,
124
124
  /// Only check if the test code is valid, without checking rule output.
125
125
  /// Turn it on when you want to ignore the output of rules.
126
- #[clap(long)]
126
+ /// Conflicts with --update-all.
127
+ #[clap(long, conflicts_with = "update_all")]
127
128
  skip_snapshot_tests: bool,
128
129
  /// Update the content of all snapshots that have changed in test.
129
- #[clap(short, long)]
130
- update_snapshots: bool,
130
+ /// Conflicts with --skip-snapshot-tests.
131
+ #[clap(short = 'U', long)]
132
+ update_all: bool,
131
133
  /// start an interactive review to update snapshots selectively
132
134
  #[clap(short, long)]
133
135
  interactive: bool,
@@ -145,7 +147,7 @@ pub fn run_test_rule(arg: TestArg) -> Result<()> {
145
147
  } else {
146
148
  let reporter = DefaultReporter {
147
149
  output: std::io::stdout(),
148
- update_snapshots: arg.update_snapshots,
150
+ update_all: arg.update_all,
149
151
  };
150
152
  run_test_rule_impl(arg, reporter)
151
153
  }
@@ -620,7 +622,7 @@ fn report_case_detail_impl<W: Write>(
620
622
 
621
623
  struct DefaultReporter<Output: Write> {
622
624
  output: Output,
623
- update_snapshots: bool,
625
+ update_all: bool,
624
626
  }
625
627
 
626
628
  impl<O: Write> Reporter for DefaultReporter<O> {
@@ -630,7 +632,7 @@ impl<O: Write> Reporter for DefaultReporter<O> {
630
632
  &mut self.output
631
633
  }
632
634
  fn collect_snapshot_action(&self) -> SnapshotAction {
633
- if self.update_snapshots {
635
+ if self.update_all {
634
636
  SnapshotAction::AcceptAll
635
637
  } else {
636
638
  SnapshotAction::AcceptNone
@@ -835,7 +837,7 @@ rule:
835
837
  fn test_run_verify() {
836
838
  let reporter = DefaultReporter {
837
839
  output: Buffer::no_color(),
838
- update_snapshots: false,
840
+ update_all: false,
839
841
  };
840
842
  let arg = TestArg {
841
843
  config: None,
@@ -843,7 +845,7 @@ rule:
843
845
  skip_snapshot_tests: true,
844
846
  snapshot_dir: None,
845
847
  test_dir: None,
846
- update_snapshots: false,
848
+ update_all: false,
847
849
  };
848
850
  // TODO
849
851
  assert!(run_test_rule_impl(arg, reporter).is_err());
@@ -10,7 +10,6 @@ use predicates::str::contains;
10
10
  fn test_simple_infer_lang() -> Result<()> {
11
11
  let dir = create_test_files([("a.ts", "console.log(123)"), ("b.rs", "console.log(456)")])?;
12
12
  Command::cargo_bin("sg")?
13
- .env("AST_GREP_NO_STDIN", "1")
14
13
  .current_dir(dir.path())
15
14
  .args(["-p", "console.log($A)"])
16
15
  .assert()
@@ -24,7 +23,6 @@ fn test_simple_infer_lang() -> Result<()> {
24
23
  fn test_simple_specific_lang() -> Result<()> {
25
24
  let dir = create_test_files([("a.ts", "console.log(123)"), ("b.rs", "console.log(456)")])?;
26
25
  Command::cargo_bin("sg")?
27
- .env("AST_GREP_NO_STDIN", "1")
28
26
  .current_dir(dir.path())
29
27
  .args(["-p", "console.log($A)", "-l", "rs"])
30
28
  .assert()
@@ -51,7 +51,7 @@ fn sg(s: &str) -> Result<()> {
51
51
  fn test_sg_scan() -> Result<()> {
52
52
  let dir = setup()?;
53
53
  let config = dir.path().join("sgconfig.yml");
54
- let ret = sg(&format!("sg scan -c {} --no-stdin", config.display()));
54
+ let ret = sg(&format!("sg scan -c {}", config.display()));
55
55
  assert!(ret.is_ok());
56
56
  drop(dir);
57
57
  Ok(())
@@ -61,7 +61,6 @@ fn test_sg_scan() -> Result<()> {
61
61
  fn test_sg_rule_off() -> Result<()> {
62
62
  let dir = setup()?;
63
63
  Command::cargo_bin("sg")?
64
- .env("AST_GREP_NO_STDIN", "1")
65
64
  .current_dir(dir.path())
66
65
  .args(["scan"])
67
66
  .assert()
@@ -8,7 +8,7 @@ edition= "2021"
8
8
  license= "MIT"
9
9
  repository= "https://github.com/ast-grep/ast-grep"
10
10
  rust-version= "1.63"
11
- version= "0.7.2"
11
+ version= "0.9.0"
12
12
 
13
13
  [features]
14
14
  default = ["regex"]
@@ -18,7 +18,7 @@ ast-grep-core.path = "../ast-grep-core"
18
18
 
19
19
  anyhow = "1.0"
20
20
  bit-set= { version = "0.5.3" }
21
- globset = "0.4.10"
21
+ globset = "0.4.11"
22
22
  regex = { version = "1.9.1" , optional = true }
23
23
  serde= { version = "1.0", features = ["derive"] }
24
24
  serde_yaml = "0.9.22"
@@ -11,7 +11,7 @@ homepage= "https://ast-grep.github.io/"
11
11
  license= "MIT"
12
12
  repository= "https://github.com/ast-grep/ast-grep"
13
13
  rust-version= "1.63"
14
- version= "0.7.2"
14
+ version= "0.9.0"
15
15
 
16
16
  [dependencies]
17
17
  bit-set= { version = "0.5.3" }
@@ -8,7 +8,7 @@ edition= "2021"
8
8
  license= "MIT"
9
9
  repository= "https://github.com/ast-grep/ast-grep"
10
10
  rust-version= "1.63"
11
- version= "0.7.2"
11
+ version= "0.9.0"
12
12
 
13
13
  [dependencies]
14
14
  ast-grep-core.path = "../ast-grep-core"
@@ -8,7 +8,7 @@ edition= "2021"
8
8
  license= "MIT"
9
9
  repository= "https://github.com/ast-grep/ast-grep"
10
10
  rust-version= "1.63"
11
- version= "0.7.2"
11
+ version= "0.9.0"
12
12
 
13
13
  [dependencies]
14
14
  ast-grep-core.path = "../ast-grep-core"
@@ -3,7 +3,7 @@ name = "ast-grep-lsp"
3
3
  description = "Search and Rewrite code at large scale using precise AST pattern"
4
4
  keywords = ["ast", "pattern", "codemod", "search", "rewrite"]
5
5
 
6
- version= "0.7.2"
6
+ version= "0.9.0"
7
7
  authors= ["Herrington Darkholme <2883231+HerringtonDarkholme@users.noreply.github.com>"]
8
8
  edition= "2021"
9
9
  license= "MIT"
@@ -16,5 +16,5 @@ ast-grep-config.path = "../ast-grep-config"
16
16
 
17
17
  dashmap = "5.4.0"
18
18
  serde= { version = "1.0", features = ["derive"] }
19
- serde_json = "1.0.100"
19
+ serde_json = "1.0.102"
20
20
  tower-lsp = "0.19.0"
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "ast-grep-cli"
7
- version = "0.7.2"
7
+ version = "0.9.0"
8
8
  description = "Structural Search and Rewrite code at large scale using precise AST pattern."
9
9
  authors = [{ name = "Herrington Darkholme", email = "2883231+HerringtonDarkholme@users.noreply.github.com" }]
10
10
  maintainers = [{ name = "Herrington Darkholme", email = "2883231+HerringtonDarkholme@users.noreply.github.com" }]
File without changes
File without changes