Skip to content

Commit 4643e18

Browse files
feat: add --threads option
1 parent 007549b commit 4643e18

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

website/reference/cli.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ sg run [OPTIONS] --pattern <PATTERN> [PATHS]...
3030
| | --no-ignore `<NO_IGNORE>` | Do not respect hidden file system or ignore files (.gitignore, .ignore, etc.) [possible values: hidden, dot, exclude, global, parent, vcs] |
3131
| | --stdin | Enable search code from StdIn. See [link](/guide/tooling-overview.html#enable-stdin-mode) |
3232
| | --globs `<GLOBS>` | Include or exclude file paths
33+
| -j| --threads <NUM> | Set the approximate number of threads to use [default: heuristic]
3334
| -i| --interactive | Start interactive edit session. Code rewrite only happens inside a session. |
3435
| -U| --update-all | Apply all rewrite without confirmation if true. |
3536
| | --json`[=<style>]` | Output matches in structured JSON [possible values: pretty, stream, compact] |
@@ -61,6 +62,7 @@ sg scan [OPTIONS] [PATHS]...
6162
| -r | --rule `<RULE_FILE>`| Scan the codebase with the single rule located at the path `RULE_FILE`.|
6263
| | --inline-rules `<RULE_TEXT>` | Scan the codebase with a rule defined by the provided `RULE_TEXT` |
6364
| | --filter `<REGEX>` |Scan the codebase with rules with ids matching `REGEX` |
65+
| -j| --threads <NUM> | Set the approximate number of threads to use [default: heuristic]
6466
| -i | --interactive|Start interactive edit session.|
6567
| | --color `<WHEN>`|Controls output color [default: auto] [possible values: auto, always, ansi, never]|
6668
| | --report-style `<REPORT_STYLE>` | [default: rich] [possible values: rich, medium, short]

website/reference/cli/run.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ Start interactive edit session.
107107

108108
You can confirm the code change and apply it to files selectively, or you can open text editor to tweak the matched code. Note that code rewrite only happens inside a session.
109109

110+
### `-j, --threads <NUM>`
111+
112+
Set the approximate number of threads to use.
113+
114+
This flag sets the approximate number of threads to use. A value of 0 (which is the default) causes ast-grep to choose the thread count using heuristics.
115+
116+
[default: 0]
117+
110118
### `-U, --update-all`
111119

112120
Apply all rewrite without confirmation if true

website/reference/cli/scan.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ Start interactive edit session.
8080

8181
You can confirm the code change and apply it to files selectively, or you can open text editor to tweak the matched code. Note that code rewrite only happens inside a session.
8282

83+
### `-j, --threads <NUM>`
84+
85+
Set the approximate number of threads to use.
86+
87+
This flag sets the approximate number of threads to use. A value of 0 (which is the default) causes ast-grep to choose the thread count using heuristics.
88+
89+
[default: 0]
90+
8391
### `-U, --update-all`
8492
Apply all rewrite without confirmation if true
8593

0 commit comments

Comments
 (0)