Skip to content

Commit

Permalink
fix(cli): do not exit after 1st formatted file
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbrunet committed Aug 2, 2023
1 parent 339c0b3 commit a4caac4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ci/release/changelogs/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
#### Improvements 🧹

#### Bugfixes ⛑️

- Fixes `d2 fmt` to format all files passed as arguments rather than first non-formatted only [#1523](https://github.com/terrastruct/d2/issues/1523)
4 changes: 3 additions & 1 deletion d2cli/fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ func fmtCmd(ctx context.Context, ms *xmain.State) (err error) {

output := []byte(d2format.Format(m))
if !bytes.Equal(output, input) {
return ms.WritePath(inputPath, output)
if err := ms.WritePath(inputPath, output); err != nil {
return err
}
}
}
return nil
Expand Down

0 comments on commit a4caac4

Please sign in to comment.