Skip to content

Commit 67a0e04

Browse files
fix: rename binary name
1 parent 252c4be commit 67a0e04

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

website/blog/migrate-bevy.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Before we start, we need to make sure that we have the following tools installed
4545
Compared to the other two tools, ast-grep is lesser-known. In short it can do search and replace based on [abstract syntax trees](https://www.wikiwand.com/en/Abstract_syntax_tree). You can install it via [`cargo`](https://crates.io/crates/ast-grep) or [`brew`](https://formulae.brew.sh/formula/ast-grep).
4646

4747
```shell
48-
# install the binary `sg`/`ast-grep`
48+
# install the binary `ast-grep`
4949
cargo install ast-grep
5050
# or use brew
5151
brew install ast-grep
@@ -149,7 +149,7 @@ So we just need to change the import name. [Using ast-grep is trivial here](http
149149
We need to provide a pattern, `-p`, for it to search as well as a rewrite string, `-r` to replace the old API with the new one. The command should be quite self-explanatory.
150150

151151
```
152-
sg -p 'CoreStage' -r CoreSet -i
152+
ast-grep -p 'CoreStage' -r CoreSet -i
153153
```
154154

155155
We suggest to add `-i` flag for `--interactive` editing. ast-grep will display the changed code diff and ask your decision to accept or not.
@@ -183,7 +183,7 @@ The [doc](https://bevyengine.org/learn/migration-guides/0.9-0.10/#label-types):
183183
184184
The command:
185185
```bash
186-
sg -p 'StageLabel' -r SystemSet -i
186+
ast-grep -p 'StageLabel' -r SystemSet -i
187187
```
188188

189189
3. `SystemStage`
@@ -217,7 +217,7 @@ app.configure_set(
217217
Let's write a command for this code migration.
218218

219219
```bash
220-
sg \
220+
ast-grep \
221221
-p '$APP.add_stage_after($STAGE, $OWN_STAGE, SystemStage::parallel())' \
222222
-r '$APP.configure_set($OWN_STAGE.after($STAGE))' -i
223223
```
@@ -231,7 +231,7 @@ meta-variable is a wildcard expression that can match any single AST node. So we
231231
However, I found some `add_stage_after`s are not replaced. Nah, ast-grep is [quite dumb](https://github.com/ast-grep/ast-grep/issues/374) that it cannot handle the optional comma after the last argument. So I used another query with a trailing comma.
232232

233233
```shell
234-
sg \
234+
ast-grep \
235235
-p 'app.add_stage_after($STAGE, $OWN_STAGE, SystemStage::parallel(),)' \
236236
-r 'app.configure_set($OWN_STAGE.after($STAGE))' -i
237237
```
@@ -267,7 +267,7 @@ app.add_system(my_system.in_base_set(CoreSet::PostUpdate))
267267
Let's also write a pattern for it.
268268

269269
```sh
270-
sg \
270+
ast-grep \
271271
-p '$APP.add_system_to_stage($STAGE, $SYS)' \
272272
-r '$APP.add_system($SYS.in_base_set($STAGE))' -i
273273
```
@@ -305,7 +305,7 @@ _It is still faster than me scratching my head about how to automate everything.
305305
Another change is to use `add_systems` instead of `add_system_set`. This is a simple pattern!
306306

307307
```sh
308-
sg \
308+
ast-grep \
309309
-p '$APP.add_system_set_to_stage($STAGE, $SYS,)' \
310310
-r '$APP.add_systems($SYS.in_set($STAGE))' -i
311311
```

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