Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/release/changelogs/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- exports: pptx follows standards more closely, addressing warnings from some Powerpoint software [#2645](https://github.com/terrastruct/d2/pull/2645)
- d2sequence: fix edge case of invalid sequence diagrams [#2660](https://github.com/terrastruct/d2/pull/2660)
- d2svg: Text may overflow legend bounds when monospace font is used [#2674](https://github.com/terrastruct/d2/pull/2674)
- fmt: always output content when formatting stdin [#2718](https://github.com/terrastruct/d2/pull/2718)

---

Expand Down
6 changes: 6 additions & 0 deletions d2cli/fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ func fmtCmd(ctx context.Context, ms *xmain.State, check bool) (err error) {
return err
}
}
} else if !check && inputPath == "-" {
// still output unchanged file to prevent deletion in
// automated setups
if err := ms.WritePath(inputPath, output); err != nil {
return err
}
}
}

Expand Down