Skip to content

Commit e6be881

Browse files
doc: update scan/new/test options
1 parent ff23512 commit e6be881

File tree

4 files changed

+66
-6
lines changed

4 files changed

+66
-6
lines changed

website/reference/cli.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ sg scan [OPTIONS] [PATHS]...
7474
| | --stdin | Enable search code from StdIn. See [link](/guide/tooling-overview.html#enable-stdin-mode) |
7575
| | --globs `<GLOBS>` | Include or exclude file paths
7676
| | --tracing `<LEVEL>` | Show tracing information for file/rule discovery and scanning [default: nothing] [possible values: nothing, summary]
77+
| | --error`[=<RULE_ID>...]`| Set rule severity to error
78+
| | --warning`[=<RULE_ID>...]`| Set rule severity to warning
79+
| | --info`[=<RULE_ID>...]`| Set rule severity to info
80+
| | --hint`[=<RULE_ID>...]`| Set rule severity to hint
81+
| | --off`[=<RULE_ID>...]`| Turn off the rule
82+
| | --after `<NUM>` | Show NUM lines after each match [default: 0] |
83+
| | --before `<NUM>` | Show NUM lines before each match [default: 0] |
84+
| | --context `<NUM>` | Show NUM lines around each match [default: 0] |
85+
| -A| --after `<NUM>` | Show NUM lines after each match [default: 0] |
86+
| -B| --before `<NUM>` | Show NUM lines before each match [default: 0] |
87+
| -C| --context `<NUM>` | Show NUM lines around each match [default: 0] |
7788
| -h| --help|Print help|
7889

7990
## `sg test`

website/reference/cli/new.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,8 @@ Accept all default options without interactive input during creation.
7272

7373
You need to provide all required arguments via command line if this flag is true. Please see the command description for the what arguments are required.
7474

75-
### `-b, --base-dir <BASE_DIR>`
76-
Create new project/items in the folder specified by this argument
77-
78-
[default: .]
75+
### `-c, --config <CONFIG_FILE>`
76+
Path to ast-grep root config, default is sgconfig.yml
7977

8078
### `-h, --help`
8179
Print help (see a summary with '-h')

website/reference/cli/scan.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,29 @@ Currently, only GitHub is supported.
121121

122122
[possible values: github]
123123

124+
## Context Options
125+
126+
### `-A, --after <NUM>`
127+
Show NUM lines after each match.
128+
129+
It conflicts with both the -C/--context flag.
130+
131+
[default: 0]
132+
133+
### `-B, --before <NUM>`
134+
Show NUM lines before each match.
135+
136+
It conflicts with both the -C/--context flag.
137+
138+
[default: 0]
139+
140+
### `-C, --context <NUM>`
141+
Show NUM lines around each match.
142+
143+
This is equivalent to providing both the -B/--before and -A/--after flags with the same value. It conflicts with both the -B/--before and -A/--after flags.
144+
145+
[default: 0]
146+
124147
## Style Options
125148

126149
### `--color <WHEN>`
@@ -144,5 +167,34 @@ Possible values:
144167
- medium: Output a condensed diagnostic, with a line number, severity, message and notes (if any)
145168
- short: Output a short diagnostic, with a line number, severity, and message
146169

170+
## Rule Options
171+
172+
These rule option flags set the specified RULE_ID's severity to a specific level. You can specify multiple rules by using the flag multiple times, e.g., `--error=RULE_1 --error=RULE_2`. If no RULE_ID is provided, all rules will be set to the specified level, e.g., `--error`. Note, these flags must use `=` to specify its value.
173+
174+
### `--error[=<RULE_ID>...]`
175+
Set rule severity to error
176+
177+
This flag sets the specified RULE_ID's severity to error. You can specify multiple rules by using the flag multiple times. If no RULE_ID is provided, all rules will be set to error. Note, this flag must use `=` to specify its value.
178+
179+
### `--warning[=<RULE_ID>...]`
180+
Set rule severity to warning
181+
182+
This flag sets the specified RULE_ID's severity to warning. You can specify multiple rules by using the flag multiple times. If no RULE_ID is provided, all rules will be set to warning. Note, this flag must use `=` to specify its value.
183+
184+
### `--info[=<RULE_ID>...]`
185+
Set rule severity to info
186+
187+
This flag sets the specified RULE_ID's severity to info. You can specify multiple rules by using the flag multiple times. If no RULE_ID is provided, all rules will be set to info. Note, this flag must use `=` to specify its value.
188+
189+
### `--hint[=<RULE_ID>...]`
190+
Set rule severity to hint
191+
192+
This flag sets the specified RULE_ID's severity to hint. You can specify multiple rules by using the flag multiple times. If no RULE_ID is provided, all rules will be set to hint. Note, this flag must use `=` to specify its value.
193+
194+
### `--off[=<RULE_ID>...]`
195+
Turn off rule
196+
197+
This flag turns off the specified RULE_ID. You can disable multiple rules by using the flag multiple times. If no RULE_ID is provided, all rules will be turned off. Note, this flag must use `=` to specify its value.
198+
147199
### `-h, --help`
148200
Print help (see a summary with '-h')

website/reference/cli/test.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ sg test [OPTIONS]
1515
## Options
1616

1717
### `-c, --config <CONFIG>`
18-
19-
Path to the root ast-grep config YAML
18+
Path to ast-grep root config, default is sgconfig.yml
2019

2120
### `-t, --test-dir <TEST_DIR>`
2221

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy