Merge branch 'terrastruct:master' into master
This commit is contained in:
commit
256ce2d51e
10 changed files with 28 additions and 26 deletions
|
|
@ -1,8 +1,11 @@
|
||||||
#### Features 🚀
|
#### Features 🚀
|
||||||
|
|
||||||
|
- `double-border` keyword implemented. [#565](https://github.com/terrastruct/d2/pull/565)
|
||||||
- The [Dockerfile](./docs/INSTALL.md#docker) now supports rendering PNGs [#594](https://github.com/terrastruct/d2/issues/594)
|
- The [Dockerfile](./docs/INSTALL.md#docker) now supports rendering PNGs [#594](https://github.com/terrastruct/d2/issues/594)
|
||||||
- There was a minor breaking change as part of this where the default working directory of the Dockerfile is now `/home/debian/src` instead of `/root/src` to allow UID remapping with [`fixuid`](https://github.com/boxboat/fixuid).
|
- There was a minor breaking change as part of this where the default working directory of the Dockerfile is now `/home/debian/src` instead of `/root/src` to allow UID remapping with [`fixuid`](https://github.com/boxboat/fixuid).
|
||||||
|
|
||||||
|
- `d2 fmt` accepts multiple files to be formatted [#718](https://github.com/terrastruct/d2/issues/718)
|
||||||
|
|
||||||
#### Improvements 🧹
|
#### Improvements 🧹
|
||||||
|
|
||||||
#### Bugfixes ⛑️
|
#### Bugfixes ⛑️
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
.Nm d2
|
.Nm d2
|
||||||
.Ar layout Op Ar name
|
.Ar layout Op Ar name
|
||||||
.Nm d2
|
.Nm d2
|
||||||
.Ar fmt Ar file.d2
|
.Ar fmt Ar file.d2 ...
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm
|
.Nm
|
||||||
compiles and renders
|
compiles and renders
|
||||||
|
|
@ -83,10 +83,8 @@ Print version information and exit.
|
||||||
Lists available layout engine options with short help.
|
Lists available layout engine options with short help.
|
||||||
.It Ar layout Op Ar name
|
.It Ar layout Op Ar name
|
||||||
Display long help for a particular layout engine, including its configuration options.
|
Display long help for a particular layout engine, including its configuration options.
|
||||||
.It Ar fmt Ar file.d2
|
.It Ar fmt Ar file.d2 ...
|
||||||
Format
|
Format all passed files.
|
||||||
.Ar file.d2
|
|
||||||
.Ns .
|
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr d2plugin-tala 1
|
.Xr d2plugin-tala 1
|
||||||
|
|
|
||||||
1
e2etests/testdata/measured/empty-class/dagre/board.exp.json
generated
vendored
1
e2etests/testdata/measured/empty-class/dagre/board.exp.json
generated
vendored
|
|
@ -20,6 +20,7 @@
|
||||||
"shadow": false,
|
"shadow": false,
|
||||||
"3d": false,
|
"3d": false,
|
||||||
"multiple": false,
|
"multiple": false,
|
||||||
|
"double-border": false,
|
||||||
"tooltip": "",
|
"tooltip": "",
|
||||||
"link": "",
|
"link": "",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ width="316" height="216" viewBox="-102 -102 316 216"><style type="text/css">
|
||||||
svgEl.setAttribute("height", height * ratio - 16);
|
svgEl.setAttribute("height", height * ratio - 16);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
]]></script><g id="a"><g class="shape" ><rect class="shape" x="0" y="0" width="112" height="12" style="fill:#FFFFFF;stroke:#0A0F25;stroke-width:2;"/><rect class="class_header" x="0.000000" y="0.000000" width="112.000000" height="12.000000" fill="#0A0F25" /><line x1="0.000000" y1="12.000000" x2="112.000000" y2="12.000000" style="stroke-width:1;stroke:#0A0F25" /></g></g><mask id="2115119125" maskUnits="userSpaceOnUse" x="-100" y="-100" width="316" height="216">
|
]]></script><g id="a"><g class="shape" ><rect class="shape" x="0" y="0" width="112" height="12" style="fill:#FFFFFF;stroke:#0A0F25;stroke-width:2;"/><rect class="class_header" x="0.000000" y="0.000000" width="112.000000" height="12.000000" fill="#0A0F25" /><line x1="0.000000" y1="12.000000" x2="112.000000" y2="12.000000" style="stroke-width:1;stroke:#0A0F25" /></g></g><mask id="3176154718" maskUnits="userSpaceOnUse" x="-100" y="-100" width="316" height="216">
|
||||||
<rect x="-100" y="-100" width="316" height="216" fill="white"></rect>
|
<rect x="-100" y="-100" width="316" height="216" fill="white"></rect>
|
||||||
|
|
||||||
</mask><style type="text/css"><![CDATA[]]></style></svg>
|
</mask><style type="text/css"><![CDATA[]]></style></svg>
|
||||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
1
e2etests/testdata/measured/empty-shape/dagre/board.exp.json
generated
vendored
1
e2etests/testdata/measured/empty-shape/dagre/board.exp.json
generated
vendored
|
|
@ -20,6 +20,7 @@
|
||||||
"shadow": false,
|
"shadow": false,
|
||||||
"3d": false,
|
"3d": false,
|
||||||
"multiple": false,
|
"multiple": false,
|
||||||
|
"double-border": false,
|
||||||
"tooltip": "",
|
"tooltip": "",
|
||||||
"link": "",
|
"link": "",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ width="304" height="304" viewBox="-102 -102 304 304"><style type="text/css">
|
||||||
svgEl.setAttribute("height", height * ratio - 16);
|
svgEl.setAttribute("height", height * ratio - 16);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
]]></script><g id="a"><g class="shape" ><rect x="0" y="0" width="100" height="100" style="fill:#F7F8FE;stroke:#0D32B2;stroke-width:2;" /></g></g><mask id="1236167803" maskUnits="userSpaceOnUse" x="-100" y="-100" width="304" height="304">
|
]]></script><g id="a"><g class="shape" ><rect x="0" y="0" width="100" height="100" style="fill:#F7F8FE;stroke:#0D32B2;stroke-width:2;" /></g></g><mask id="3624597608" maskUnits="userSpaceOnUse" x="-100" y="-100" width="304" height="304">
|
||||||
<rect x="-100" y="-100" width="304" height="304" fill="white"></rect>
|
<rect x="-100" y="-100" width="304" height="304" fill="white"></rect>
|
||||||
|
|
||||||
</mask><style type="text/css"><![CDATA[]]></style></svg>
|
</mask><style type="text/css"><![CDATA[]]></style></svg>
|
||||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
1
e2etests/testdata/measured/empty-sql_table/dagre/board.exp.json
generated
vendored
1
e2etests/testdata/measured/empty-sql_table/dagre/board.exp.json
generated
vendored
|
|
@ -20,6 +20,7 @@
|
||||||
"shadow": false,
|
"shadow": false,
|
||||||
"3d": false,
|
"3d": false,
|
||||||
"multiple": false,
|
"multiple": false,
|
||||||
|
"double-border": false,
|
||||||
"tooltip": "",
|
"tooltip": "",
|
||||||
"link": "",
|
"link": "",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ width="254" height="216" viewBox="-102 -102 254 216"><style type="text/css">
|
||||||
svgEl.setAttribute("height", height * ratio - 16);
|
svgEl.setAttribute("height", height * ratio - 16);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
]]></script><g id="a"><g class="shape" ><rect class="shape" x="0" y="0" width="50" height="12" style="fill:#FFFFFF;stroke:#0A0F25;stroke-width:2;"/><rect class="class_header" x="0.000000" y="0.000000" width="50.000000" height="12.000000" fill="#0A0F25" /></g></g><mask id="2389823220" maskUnits="userSpaceOnUse" x="-100" y="-100" width="254" height="216">
|
]]></script><g id="a"><g class="shape" ><rect class="shape" x="0" y="0" width="50" height="12" style="fill:#FFFFFF;stroke:#0A0F25;stroke-width:2;"/><rect class="class_header" x="0.000000" y="0.000000" width="50.000000" height="12.000000" fill="#0A0F25" /></g></g><mask id="1023975809" maskUnits="userSpaceOnUse" x="-100" y="-100" width="254" height="216">
|
||||||
<rect x="-100" y="-100" width="254" height="216" fill="white"></rect>
|
<rect x="-100" y="-100" width="254" height="216" fill="white"></rect>
|
||||||
|
|
||||||
</mask><style type="text/css"><![CDATA[]]></style></svg>
|
</mask><style type="text/css"><![CDATA[]]></style></svg>
|
||||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
30
fmt.go
30
fmt.go
|
|
@ -17,26 +17,24 @@ func fmtCmd(ctx context.Context, ms *xmain.State) (err error) {
|
||||||
|
|
||||||
ms.Opts = xmain.NewOpts(ms.Env, ms.Log, ms.Opts.Flags.Args()[1:])
|
ms.Opts = xmain.NewOpts(ms.Env, ms.Log, ms.Opts.Flags.Args()[1:])
|
||||||
if len(ms.Opts.Args) == 0 {
|
if len(ms.Opts.Args) == 0 {
|
||||||
return xmain.UsageErrorf("fmt must be passed the file to be formatted")
|
return xmain.UsageErrorf("fmt must be passed at least one file to be formatted")
|
||||||
} else if len(ms.Opts.Args) > 1 {
|
|
||||||
return xmain.UsageErrorf("fmt accepts only one argument for the file to be formatted")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inputPath := ms.Opts.Args[0]
|
for _, inputPath := range ms.Opts.Args {
|
||||||
input, err := ms.ReadPath(inputPath)
|
input, err := ms.ReadPath(inputPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
m, err := d2parser.Parse(inputPath, bytes.NewReader(input), nil)
|
m, err := d2parser.Parse(inputPath, bytes.NewReader(input), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
output := []byte(d2format.Format(m))
|
output := []byte(d2format.Format(m))
|
||||||
if !bytes.Equal(output, input) {
|
if !bytes.Equal(output, input) {
|
||||||
return ms.WritePath(inputPath, output)
|
return ms.WritePath(inputPath, output)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
help.go
4
help.go
|
|
@ -18,7 +18,7 @@ func help(ms *xmain.State) {
|
||||||
fmt.Fprintf(ms.Stdout, `Usage:
|
fmt.Fprintf(ms.Stdout, `Usage:
|
||||||
%[1]s [--watch=false] [--theme=0] file.d2 [file.svg | file.png]
|
%[1]s [--watch=false] [--theme=0] file.d2 [file.svg | file.png]
|
||||||
%[1]s layout [name]
|
%[1]s layout [name]
|
||||||
%[1]s fmt file.d2
|
%[1]s fmt file.d2 ...
|
||||||
|
|
||||||
%[1]s compiles and renders file.d2 to file.svg | file.png
|
%[1]s compiles and renders file.d2 to file.svg | file.png
|
||||||
It defaults to file.svg if an output path is not provided.
|
It defaults to file.svg if an output path is not provided.
|
||||||
|
|
@ -33,7 +33,7 @@ Flags:
|
||||||
Subcommands:
|
Subcommands:
|
||||||
%[1]s layout - Lists available layout engine options with short help
|
%[1]s layout - Lists available layout engine options with short help
|
||||||
%[1]s layout [name] - Display long help for a particular layout engine, including its configuration options
|
%[1]s layout [name] - Display long help for a particular layout engine, including its configuration options
|
||||||
%[1]s fmt file.d2 - Format file.d2
|
%[1]s fmt file.d2 ... - Format passed files
|
||||||
|
|
||||||
See more docs and the source code at https://oss.terrastruct.com/d2
|
See more docs and the source code at https://oss.terrastruct.com/d2
|
||||||
`, filepath.Base(ms.Name), ms.Opts.Defaults())
|
`, filepath.Base(ms.Name), ms.Opts.Defaults())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue