Compare commits

...

2 Commits

Author SHA1 Message Date
Dmitriy Pleshevskiy 243d3bfb4f
add support of port attribute 2023-02-16 23:52:40 +03:00
Dmitriy Pleshevskiy f387572eb0
deps: update to latest version 2023-02-16 23:48:56 +03:00
3 changed files with 20 additions and 18 deletions

View File

@ -1,8 +1,8 @@
# *W*rapped _d2_
A wrapper over [d2] which allows to use \`layout\`, \`theme\`, \`pad\`
attributes from d2 file. All arguments will be passed to the d2 cli, but these
additional configs overwrite cli arguments with the same name.
A wrapper over [d2] which allows to use `layout`, `theme`, `pad`, `sketch` and
`port` attributes from d2 file. All arguments will be passed to the d2 cli, but
these additional configs overwrite cli arguments with the same name.
[d2]: https://github.com/terrastruct/d2

View File

@ -2,11 +2,11 @@
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"type": "github"
},
"original": {
@ -32,11 +32,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1672756850,
"narHash": "sha256-Smbq3+fitwA13qsTMeaaurv09/KVbZfW7m7lINwzDGA=",
"lastModified": 1676518424,
"narHash": "sha256-OsJSBwl9Hayh/bmxDtUyxm2U6btaBHuLvviE9KpMmwQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "298add347c2bbce14020fcb54051f517c391196b",
"rev": "a592a97fcedae7a06b8506623b25fd38a032ad13",
"type": "github"
},
"original": {
@ -71,11 +71,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1672803623,
"narHash": "sha256-cm2/Vry2ZM0cHeAFrJp/WXgIFI8p+Aj69GD9QqI3Tb8=",
"lastModified": 1676488781,
"narHash": "sha256-lP2UWGwangM1OSBOx0EFXOtnSBuyTJn3yza3Ujb9/C8=",
"ref": "refs/heads/main",
"rev": "b11347fa9d374b2938d6e2e50f08a8fa03bfdeb0",
"revCount": 20,
"rev": "5f07d4e256c1d8caefd52563737b1e3c023b5d35",
"revCount": 21,
"type": "git",
"url": "https://git.pleshevski.ru/mynix/tools"
},

12
wd2
View File

@ -10,10 +10,10 @@ function print_help() {
Usage:
wd2 [FLAGS...] file.d2 [file.svg | file.png]
A wrapper over d2 which allows to use \`layout\`, \`theme\`, \`pad\`
attributes from d2 file. All arguments will be passed to the d2 cli,
but these additional configs overwrite cli arguments with the
same name.
A wrapper over d2 which allows to use \`layout\`, \`theme\`, \`pad\`,
\`sketch\` and \`port\` attributes from d2 file. All arguments will
be passed to the d2 cli, but these additional configs overwrite cli
arguments with the same name.
$(d2 --help | tail -n +6 - | sed -e 's/d2 \(layout\|fmt\)/wd2 \1/')
EOF
@ -63,11 +63,13 @@ d2_layout=$(get_attr_value "layout")
d2_theme=$(get_attr_value "theme")
d2_pad=$(get_attr_value "pad")
d2_sketch=$(get_attr_value "sketch")
d2_port=$(get_attr_value "port")
set -e
d2 "${d2_args[@]}" \
${d2_layout:+--layout=${d2_layout}} \
${d2_theme:+--theme=${d2_theme}} \
${d2_pad:+--pad=${d2_pad}} \
${d2_sketch:+--sketch=${d2_sketch}}
${d2_sketch:+--sketch=${d2_sketch}} \
${d2_port:+--port=${d2_port}}