Skip to content

Commit 53fce6f

Browse files
fix: rename command part 8
1 parent 6f529df commit 53fce6f

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

website/guide/introduction.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ast-grep is a new AST based tool for managing your code, at massive scale.
1515
Using ast-grep can be as simple as running a single command in your terminal:
1616

1717
```bash
18-
sg --pattern 'var code = $PAT' --rewrite 'let code = $PAT' --lang js
18+
ast-grep --pattern 'var code = $PAT' --rewrite 'let code = $PAT' --lang js
1919
```
2020

2121
The command above will replace `var` statement with `let` for all <abbr title="ast-grep will also infer the language if you omit --lang">JavaScript</abbr> files.
@@ -24,7 +24,7 @@ The command above will replace `var` statement with `let` for all <abbr title="a
2424

2525
ast-grep is a versatile tool for searching, linting and rewriting code in various languages.
2626

27-
* **Search**: As a command line tool in your terminal, ast-grep, `sg`, can precisely search code based on AST, running through ten thousand files in sub seconds.
27+
* **Search**: As a command line tool in your terminal, `ast-grep` can precisely search code based on AST, running through ten thousand files in sub seconds.
2828
* **Lint**: You can also use ast-grep as a linter. Thanks to the flexible rule configuration, adding a new customized rule is more intuitive and straightforward. It also has a pretty error reporting out of box
2929
* **Rewrite**: ast-grep provide jQuery like utility methods to traverse and manipulate syntax tree. Besides, you can also use operators to compose complex matching from simple patterns.
3030

@@ -71,7 +71,7 @@ Consider it as same as `grep` but based on AST instead of text.
7171
In comparison to Babel, we can complete this hello-world task in ast-grep trivially
7272

7373
```bash
74-
sg -p "console.log"
74+
ast-grep -p "console.log"
7575
```
7676

7777
See [playground](/playground.html) in action!

website/guide/rewrite-code.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ One of the powers of ast-grep is that it can not only find code patterns, but al
44

55
For example, you may want to rename a variable, change a function call, or add a comment. ast-grep provides two ways to do this: using the `--rewrite` flag or using the `fix` key in YAML rules.
66

7-
## Using `sg run -p 'pat' --rewrite`
7+
## Using `ast-grep run -p 'pat' --rewrite`
88

9-
The simplest way to rewrite code is to use the `--rewrite` flag with the `sg run` command. This flag takes a string argument that specifies the new code to replace the matched pattern.
9+
The simplest way to rewrite code is to use the `--rewrite` flag with the `ast-grep run` command. This flag takes a string argument that specifies the new code to replace the matched pattern.
1010
For example, if you want to change all occurrences of identifier `foo` to `bar`, you can run:
1111

1212
```bash
13-
sg run --pattern 'foo' --rewrite 'bar' --lang python
13+
ast-grep run --pattern 'foo' --rewrite 'bar' --lang python
1414
```
1515

1616
This will show you a diff of the changes that will be made. If you are using interactive mode by the `--interactive` flag, ast-grep ask you if you want to apply them.
@@ -58,7 +58,7 @@ fix: baz($X)
5858
The first rule matches the definition of the function `foo`, and replaces it with `baz`. The second rule matches the calls of the function `foo`, and replaces them with `baz`. Note that we use `$X` and `$$$S` as [meta](/guide/pattern-syntax.html#meta-variable) [variables](/guide/pattern-syntax.html#multi-meta-variable), which can match any expression and any statement, respectively. We can run:
5959

6060
```bash
61-
sg scan -r change_func.yml test.py
61+
ast-grep scan -r change_func.yml test.py
6262
```
6363

6464
This will show us the following diff:

website/guide/tools/editors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ ast-grep does not have LSP configuration, except that ast-grep LSP requires `sgc
161161
You can also specify the configuration file path via command line:
162162

163163
```bash
164-
sg lsp -c <configPath>
164+
ast-grep lsp -c <configPath>
165165
```
166166

167167
## More Editors...

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