Skip to content

Commit b8282ec

Browse files
fix: rename command name part 2
1 parent 67a0e04 commit b8282ec

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

website/advanced/language-injection.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Let's start with a simple example of searching for JavaScript and CSS within HTM
2424
ast-grep has builtin support to search JavaScript and CSS inside HTML files.
2525

2626

27-
### **Using `sg run`**: find patterns of CSS in an HTML file
27+
### **Using `ast-grep run`**: find patterns of CSS in an HTML file
2828

2929
Suppose we have an HTML file like below:
3030

@@ -43,7 +43,7 @@ Suppose we have an HTML file like below:
4343
Running this ast-grep command will extract the matching CSS style code out of the HTML file!
4444

4545
```sh
46-
sg run -p 'color: $COLOR'
46+
ast-grep run -p 'color: $COLOR'
4747
```
4848

4949
ast-grep outputs this beautiful CLI report.
@@ -55,7 +55,7 @@ test.html
5555
ast-grep works well even if just providing the pattern without specifying the pattern language!
5656

5757

58-
### **Using `sg scan`**: find JavaScript in HTML with rule files
58+
### **Using `ast-grep scan`**: find JavaScript in HTML with rule files
5959

6060
You can also use ast-grep's [rule file](https://ast-grep.github.io/guide/rule-config.html) to search injected languages.
6161

@@ -70,10 +70,10 @@ rule:
7070
message: Prefer use appropriate custom UI instead of obtrusive alert call.
7171
```
7272
73-
The rule above will detect usage of `alert` in JavaScript. Running the rule via `sg scan`.
73+
The rule above will detect usage of `alert` in JavaScript. Running the rule via `ast-grep scan`.
7474

7575
```sh
76-
sg scan --rule no-alert.yml
76+
ast-grep scan --rule no-alert.yml
7777
```
7878

7979
The command leverages built-in behaviors in ast-grep to handle language injection seamlessly. It will produce the following warning message for the HTML file above.
@@ -159,7 +159,7 @@ With the above `languageInjections` configuration, ast-grep will:
159159
You can search the CSS inside JavaScript in the project configuration folder using this command:
160160

161161
```sh
162-
sg -p 'background: $COLOR' -C 2
162+
ast-grep -p 'background: $COLOR' -C 2
163163
```
164164

165165
It will produce the match result:
@@ -223,7 +223,7 @@ const artistsQuery = graphql`
223223
We can search the GraphQL fragment via this `--inline-rules` scan.
224224

225225
```sh
226-
sg scan --inline-rules="{id: test, language: graphql, rule: {kind: fragment_spread}}"
226+
ast-grep scan --inline-rules="{id: test, language: graphql, rule: {kind: fragment_spread}}"
227227
```
228228

229229
Output

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