Skip to content

Commit

Permalink
docs: add exemple of command that format all files recursively
Browse files Browse the repository at this point in the history
  • Loading branch information
raisepartner-yannick committed Dec 19, 2023
1 parent 41e9889 commit c3da516
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,33 @@ SCADFormat is a command line tool.

SCADFormat can be run directly on a file by specifying the filename on the command line:

$ scadformat my-source.scad
INFO formatting file my-source.scad

```bash
scadformat my-source.scad
```
```
INFO formatting file my-source.scad
```
In this mode, SCADFormat will overwrite the existing code with the formatted version. Note that SCADFormat creates a backup of the original file (with a .scadbak extension) before overwriting it.

### Read from stdin / write to stdout

SCADFormat can also read from stdin and write to stdout as follows:

$ scadformat <my-source.scad >my-source-formatted.scad
```bash
scadformat <my-source.scad >my-source-formatted.scad
```

### Format all .scad recursively

Format all .scad files in the directory "." recursively
```bash
find . -type f -name "*.scad" -exec scadformat "{}" \;
```

If you are ok with the result, you can delete all backup files (.scadbak)
```bash
find $directory -type f -name "*.scadbak" -exec rm "{}" \;
```

## Building

Expand Down Expand Up @@ -59,7 +76,6 @@ ANTLR Parser Generator Version 4.13.1
...
```


### Checkout And Build

Once ANTLR and Go are installed, the SCADFormat can be built as follows:
Expand Down

0 comments on commit c3da516

Please sign in to comment.