Skip to content

Commit

Permalink
update readme to show how to clear the terminal on restart
Browse files Browse the repository at this point in the history
  • Loading branch information
bokwoon95 committed Oct 30, 2024
1 parent 33e6e73 commit 0978447
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,21 @@ $ wgo -file .go go build -o main main.go :: bash -c 'if ./main; then echo "passe
$ wgo -file .go go build -o main main.go :: pwsh.exe -command './main; if ($LastExitCode -eq 0) { echo "passed" } else { echo "failed" }'
```

### Clear terminal on restart

You can chain the `clear` command (or the `cls` command if you're on Windows) so that the terminal is cleared before everything restarts. You will not be able to use the `wgo run` command, instead you'll have to use the `wgo` command as a general-purpose file watcher to rerun `go run main.go` when a .go file changes.

```shell
# Clears the screen.
$ clear

# When a .go file changes, clear the screen and run go run main.go.
$ wgo -file .go clear :: go run main.go

# If you're on Windows:
$ wgo -file .go cls :: go run main.go
```

## Running parallel wgo commands

If a [command separator `::`](#chaining-commands) is followed by `wgo`, a new `wgo` command is started (which runs in parallel).
Expand Down

0 comments on commit 0978447

Please sign in to comment.