From f83a5503c963b4523e99c14c2351a639a9ae1a99 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Sat, 25 Feb 2023 22:11:14 +0300 Subject: [PATCH] add support of dark-theme attribute --- README.md | 6 +++--- flake.lock | 14 +++++++------- wd2 | 8 +++++--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index f33cecf..9e190bc 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # *W*rapped _d2_ -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. +A wrapper over [d2] which allows to use `layout`, `theme`, `dark-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 diff --git a/flake.lock b/flake.lock index 8cd699a..43ad4fd 100644 --- a/flake.lock +++ b/flake.lock @@ -32,11 +32,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1676518424, - "narHash": "sha256-OsJSBwl9Hayh/bmxDtUyxm2U6btaBHuLvviE9KpMmwQ=", + "lastModified": 1677262115, + "narHash": "sha256-DPkHiJw2QnKYAzQXBlwelwghxbcD5oigK2kLPHMpMQ8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a592a97fcedae7a06b8506623b25fd38a032ad13", + "rev": "806075be2bdde71895359ed18cb530c4d323e6f6", "type": "github" }, "original": { @@ -71,11 +71,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1676488781, - "narHash": "sha256-lP2UWGwangM1OSBOx0EFXOtnSBuyTJn3yza3Ujb9/C8=", + "lastModified": 1677351205, + "narHash": "sha256-QfzWWLbpX7iYXSDWbqshF7VAXVnz/SAMu5JjEXPlbfA=", "ref": "refs/heads/main", - "rev": "5f07d4e256c1d8caefd52563737b1e3c023b5d35", - "revCount": 21, + "rev": "1230292d1e04a1fb9228ae48d202c42b74eab5d2", + "revCount": 22, "type": "git", "url": "https://git.pleshevski.ru/mynix/tools" }, diff --git a/wd2 b/wd2 index 83b9226..8ac7e12 100755 --- a/wd2 +++ b/wd2 @@ -10,9 +10,9 @@ function print_help() { Usage: wd2 [FLAGS...] file.d2 [file.svg | file.png] -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 +A wrapper over d2 which allows to use 'layout', 'theme', 'dark-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/') @@ -61,6 +61,7 @@ fi set +e d2_layout=$(get_attr_value "layout") d2_theme=$(get_attr_value "theme") +d2_dark_theme=$(get_attr_value "dark-theme") d2_pad=$(get_attr_value "pad") d2_sketch=$(get_attr_value "sketch") d2_port=$(get_attr_value "port") @@ -69,6 +70,7 @@ set -e d2 "${d2_args[@]}" \ ${d2_layout:+--layout=${d2_layout}} \ ${d2_theme:+--theme=${d2_theme}} \ + ${d2_dark_theme:+--dark-theme=${d2_dark_theme}} \ ${d2_pad:+--pad=${d2_pad}} \ ${d2_sketch:+--sketch=${d2_sketch}} \ ${d2_port:+--port=${d2_port}}