Switch to custom templating library

This commit is contained in:
2021-05-20 16:16:02 +02:00
parent 6f8e1d46c7
commit 00412be372
8 changed files with 207 additions and 395 deletions

454
manager/Cargo.lock generated
View File

@ -4,9 +4,9 @@ version = 3
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "0.7.15" version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@ -20,6 +20,12 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "arrayvec"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]] [[package]]
name = "async-recursion" name = "async-recursion"
version = "0.3.2" version = "0.3.2"
@ -48,12 +54,6 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "base64"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.2.1" version = "1.2.1"
@ -61,38 +61,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]] [[package]]
name = "block-buffer" name = "bitvec"
version = "0.7.3" version = "0.19.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" checksum = "8942c8d352ae1838c9dda0b0ca2ab657696ef2232a20147cf1b30ae1a9cb4321"
dependencies = [ dependencies = [
"block-padding", "funty",
"byte-tools", "radium",
"byteorder", "tap",
"generic-array", "wyz",
] ]
[[package]] [[package]]
name = "block-padding" name = "blueprint"
version = "0.1.5" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://git.nubo.sh/hulthe/blueprint.git#2d0875188e3d378a825d24348de4d92a228bf420"
checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5"
dependencies = [ dependencies = [
"byte-tools", "nom",
"structopt",
] ]
[[package]]
name = "byte-tools"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
[[package]]
name = "byteorder"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]] [[package]]
name = "bytes" name = "bytes"
version = "1.0.1" version = "1.0.1"
@ -120,66 +108,22 @@ dependencies = [
"vec_map", "vec_map",
] ]
[[package]]
name = "compound-error"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "106f619aa16d817037b5820326364166e67c52d1a78eb6f37ba354ec82b617c5"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "convert_case"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
[[package]]
name = "derive_more"
version = "0.99.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f82b1b72f1263f214c0f823371768776c4f5841b942c9883aa8e5ec584fd0ba6"
dependencies = [
"convert_case",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "digest"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
dependencies = [
"generic-array",
]
[[package]] [[package]]
name = "dotfiles" name = "dotfiles"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"async-recursion", "async-recursion",
"compound-error", "blueprint",
"futures", "futures",
"log", "log",
"pretty_env_logger", "pretty_env_logger",
"serde", "serde",
"structopt", "structopt",
"templar", "thiserror",
"tokio", "tokio",
"xdg", "xdg",
] ]
[[package]]
name = "dtoa"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0"
[[package]] [[package]]
name = "env_logger" name = "env_logger"
version = "0.7.1" version = "0.7.1"
@ -194,16 +138,16 @@ dependencies = [
] ]
[[package]] [[package]]
name = "fake-simd" name = "funty"
version = "0.1.2" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7"
[[package]] [[package]]
name = "futures" name = "futures"
version = "0.3.13" version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f55667319111d593ba876406af7c409c0ebb44dc4be6132a783ccf163ea14c1" checksum = "0e7e43a803dae2fa37c1f6a8fe121e1f7bf9548b4dfc0522a42f34145dadfc27"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@ -216,9 +160,9 @@ dependencies = [
[[package]] [[package]]
name = "futures-channel" name = "futures-channel"
version = "0.3.13" version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939" checksum = "e682a68b29a882df0545c143dc3646daefe80ba479bcdede94d5a703de2871e2"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
@ -226,15 +170,15 @@ dependencies = [
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.13" version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15496a72fabf0e62bdc3df11a59a3787429221dd0710ba8ef163d6f7a9112c94" checksum = "0402f765d8a89a26043b889b26ce3c4679d268fa6bb22cd7c6aad98340e179d1"
[[package]] [[package]]
name = "futures-executor" name = "futures-executor"
version = "0.3.13" version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "891a4b7b96d84d5940084b2a37632dd65deeae662c114ceaa2c879629c9c0ad1" checksum = "badaa6a909fac9e7236d0620a2f57f7664640c56575b71a7552fbd68deafab79"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-task", "futures-task",
@ -243,16 +187,17 @@ dependencies = [
[[package]] [[package]]
name = "futures-io" name = "futures-io"
version = "0.3.13" version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59" checksum = "acc499defb3b348f8d8f3f66415835a9131856ff7714bf10dadfc4ec4bdb29a1"
[[package]] [[package]]
name = "futures-macro" name = "futures-macro"
version = "0.3.13" version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea405816a5139fb39af82c2beb921d52143f556038378d6db21183a5c37fbfb7" checksum = "a4c40298486cdf52cc00cd6d6987892ba502c7656a16a4192a9992b1ccedd121"
dependencies = [ dependencies = [
"autocfg",
"proc-macro-hack", "proc-macro-hack",
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -261,22 +206,23 @@ dependencies = [
[[package]] [[package]]
name = "futures-sink" name = "futures-sink"
version = "0.3.13" version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85754d98985841b7d4f5e8e6fbfa4a4ac847916893ec511a2917ccd8525b8bb3" checksum = "a57bead0ceff0d6dde8f465ecd96c9338121bb7717d3e7b108059531870c4282"
[[package]] [[package]]
name = "futures-task" name = "futures-task"
version = "0.3.13" version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa189ef211c15ee602667a6fcfe1c1fd9e07d42250d2156382820fba33c9df80" checksum = "8a16bef9fc1a4dddb5bee51c989e3fbba26569cbb0e31f5b303c184e3dd33dae"
[[package]] [[package]]
name = "futures-util" name = "futures-util"
version = "0.3.13" version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1" checksum = "feb5c238d27e2bf94ffdfd27b2c29e3df4a68c4193bb6427384259e2bf191967"
dependencies = [ dependencies = [
"autocfg",
"futures-channel", "futures-channel",
"futures-core", "futures-core",
"futures-io", "futures-io",
@ -291,15 +237,6 @@ dependencies = [
"slab", "slab",
] ]
[[package]]
name = "generic-array"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd"
dependencies = [
"typenum",
]
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.3.2" version = "0.3.2"
@ -336,12 +273,6 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "itoa"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.4.0"
@ -349,22 +280,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "lexical-core"
version = "0.2.92" version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56d855069fafbb9b344c0f962150cd2c1187975cb1c22c1522c240d8c4986714" checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe"
dependencies = [
"arrayvec",
"bitflags",
"cfg-if",
"ryu",
"static_assertions",
]
[[package]] [[package]]
name = "linked-hash-map" name = "libc"
version = "0.5.4" version = "0.2.94"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" checksum = "18794a8ad5b29321f790b55d93dfba91e125cb1a9edbd4f8e3150acc771c1a5e"
[[package]] [[package]]
name = "lock_api" name = "lock_api"
version = "0.4.3" version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3c91c24eae6777794bb1997ad98bbb87daf92890acab859f7eaa4320333176" checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb"
dependencies = [ dependencies = [
"scopeguard", "scopeguard",
] ]
@ -378,17 +316,11 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "maplit"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.3.4" version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
[[package]] [[package]]
name = "mio" name = "mio"
@ -412,6 +344,19 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "nom"
version = "6.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2"
dependencies = [
"bitvec",
"funty",
"lexical-core",
"memchr",
"version_check",
]
[[package]] [[package]]
name = "ntapi" name = "ntapi"
version = "0.3.6" version = "0.3.6"
@ -421,15 +366,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "num-traits"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
dependencies = [
"autocfg",
]
[[package]] [[package]]
name = "num_cpus" name = "num_cpus"
version = "1.13.0" version = "1.13.0"
@ -446,21 +382,6 @@ version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3"
[[package]]
name = "opaque-debug"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
[[package]]
name = "ordered-float"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "766f840da25490628d8e63e529cd21c014f6600c6b8517add12a6fa6167a6218"
dependencies = [
"num-traits",
]
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.11.1" version = "0.11.1"
@ -486,49 +407,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "pest"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53"
dependencies = [
"ucd-trie",
]
[[package]]
name = "pest_derive"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0"
dependencies = [
"pest",
"pest_generator",
]
[[package]]
name = "pest_generator"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55"
dependencies = [
"pest",
"pest_meta",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "pest_meta"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d"
dependencies = [
"maplit",
"pest",
"sha-1",
]
[[package]] [[package]]
name = "pin-project-lite" name = "pin-project-lite"
version = "0.2.6" version = "0.2.6"
@ -589,9 +467,9 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.26" version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038"
dependencies = [ dependencies = [
"unicode-xid", "unicode-xid",
] ]
@ -612,19 +490,25 @@ dependencies = [
] ]
[[package]] [[package]]
name = "redox_syscall" name = "radium"
version = "0.2.5" version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8"
[[package]]
name = "redox_syscall"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc"
dependencies = [ dependencies = [
"bitflags", "bitflags",
] ]
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.4.5" version = "1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@ -633,9 +517,9 @@ dependencies = [
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.6.23" version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]] [[package]]
name = "ryu" name = "ryu"
@ -651,59 +535,24 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.125" version = "1.0.126"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.125" version = "1.0.126"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d" checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
] ]
[[package]]
name = "serde_json"
version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79"
dependencies = [
"itoa",
"ryu",
"serde",
]
[[package]]
name = "serde_yaml"
version = "0.8.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15654ed4ab61726bf918a39cb8d98a2e2995b002387807fa6ba58fdf7f59bb23"
dependencies = [
"dtoa",
"linked-hash-map",
"serde",
"yaml-rust",
]
[[package]]
name = "sha-1"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df"
dependencies = [
"block-buffer",
"digest",
"fake-simd",
"opaque-debug",
]
[[package]] [[package]]
name = "signal-hook-registry" name = "signal-hook-registry"
version = "1.3.0" version = "1.3.0"
@ -715,9 +564,9 @@ dependencies = [
[[package]] [[package]]
name = "slab" name = "slab"
version = "0.4.2" version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527"
[[package]] [[package]]
name = "smallvec" name = "smallvec"
@ -725,6 +574,12 @@ version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.8.0" version = "0.8.0"
@ -757,9 +612,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.68" version = "1.0.72"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87" checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -767,34 +622,10 @@ dependencies = [
] ]
[[package]] [[package]]
name = "templar" name = "tap"
version = "0.5.0" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b4a3b2a09395dd7f898d4334565af031f82c1cab88a29ab35ebc2b53843f994" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
dependencies = [
"base64",
"derive_more",
"lazy_static",
"parking_lot",
"pest",
"pest_derive",
"serde",
"serde_json",
"serde_yaml",
"templar_macros",
"unstructured",
]
[[package]]
name = "templar_macros"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e33911b223167a20560729d8e0ba5f82b2ed81516d28f1864e6c062bdcee44c"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "termcolor" name = "termcolor"
@ -815,10 +646,30 @@ dependencies = [
] ]
[[package]] [[package]]
name = "tokio" name = "thiserror"
version = "1.4.0" version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "134af885d758d645f0f0505c9a8b3f9bf8a348fd822e112ab5248138348f1722" checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tokio"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd3076b5c8cc18138b8f8814895c11eb4de37114a5d127bafdc5e55798ceef37"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"bytes", "bytes",
@ -836,27 +687,15 @@ dependencies = [
[[package]] [[package]]
name = "tokio-macros" name = "tokio-macros"
version = "1.1.0" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "caf7b11a536f46a809a8a9f0bb4237020f70ecbf115b842360afb127ea2fda57" checksum = "c49e3df43841dafb86046472506755d8501c5615673955f6aa17181125d13c37"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
] ]
[[package]]
name = "typenum"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06"
[[package]]
name = "ucd-trie"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
[[package]] [[package]]
name = "unicode-segmentation" name = "unicode-segmentation"
version = "1.7.1" version = "1.7.1"
@ -871,19 +710,9 @@ checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
version = "0.2.1" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "unstructured"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bae5a28ab9d8cd21bb5300077b36a70809ff6a4ce3fc3915767c59fbdf35b7bc"
dependencies = [
"ordered-float",
"serde",
]
[[package]] [[package]]
name = "vec_map" name = "vec_map"
@ -928,17 +757,14 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "wyz"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214"
[[package]] [[package]]
name = "xdg" name = "xdg"
version = "2.2.0" version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57" checksum = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57"
[[package]]
name = "yaml-rust"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
dependencies = [
"linked-hash-map",
]

View File

@ -11,8 +11,10 @@ log = "0.4.14"
futures = "0.3.13" futures = "0.3.13"
async-recursion = "0.3.2" async-recursion = "0.3.2"
xdg = "2.2.0" xdg = "2.2.0"
templar = "0.5.0" thiserror = "1.0.24"
compound-error = "0.1.2"
[dependencies.blueprint]
git = "https://git.nubo.sh/hulthe/blueprint.git"
[dependencies.serde] [dependencies.serde]
version = "1.0.125" version = "1.0.125"

View File

@ -1,12 +1,12 @@
use crate::error::{Error, ErrorLocation, Errors}; use crate::error::{Error, ErrorLocation, Errors, InnerError};
use crate::{ColorMode, Config}; use crate::Config;
use async_recursion::async_recursion; use async_recursion::async_recursion;
use blueprint::{parse_file, Env, Value};
use futures::future::join_all; use futures::future::join_all;
use serde::Serialize; use serde::Serialize;
use std::ffi::OsStr; use std::ffi::OsStr;
use std::io::ErrorKind; use std::io::ErrorKind;
use std::path::PathBuf; use std::path::PathBuf;
use templar::{Context, InnerData, StandardContext, Templar};
use tokio::fs::{copy, create_dir, read_dir, read_to_string, write}; use tokio::fs::{copy, create_dir, read_dir, read_to_string, write};
use tokio::join; use tokio::join;
@ -20,35 +20,28 @@ struct TemplateContext<'a> {
const TEMPLATE_EXTENSION: &str = "tpl"; const TEMPLATE_EXTENSION: &str = "tpl";
pub async fn build_tree(cfg: &Config) -> Result<(), Errors> { pub async fn build_tree(cfg: &Config) -> Result<(), Errors> {
let tpl = Templar::global();
let hostname_path: PathBuf = "/etc/hostname".into(); let hostname_path: PathBuf = "/etc/hostname".into();
let hostname = read_to_string(&hostname_path) let hostname = read_to_string(&hostname_path)
.await .await
.with_location(&hostname_path)?; .with_location(&hostname_path)?;
let darkmode = cfg.color == ColorMode::Dark; let mut env = Env::new();
let ctx = StandardContext::new(); env.insert("hostname".into(), Value::Str(hostname));
ctx.set(
InnerData::new(TemplateContext {
hostname: hostname.trim(),
darkmode,
lightmode: !darkmode,
})
.expect("serialize template context"),
)
.expect("set template context");
dir(cfg, &ctx, &tpl, PathBuf::new()).await for flag in &cfg.flags {
env.insert(flag.to_string(), Value::Bool(true));
}
info!("env:");
for (k, v) in &env {
info!(" {}: {:?}", k, v);
}
dir(cfg, &env, PathBuf::new()).await
} }
#[async_recursion] #[async_recursion]
async fn dir( async fn dir(cfg: &Config, env: &Env, relative: PathBuf) -> Result<(), Errors> {
cfg: &Config,
ctx: &StandardContext,
tpl: &Templar,
relative: PathBuf,
) -> Result<(), Errors> {
let template_path = cfg.template_dir.join(&relative); let template_path = cfg.template_dir.join(&relative);
let build_path = cfg.build_dir.join(&relative); let build_path = cfg.build_dir.join(&relative);
@ -72,9 +65,9 @@ async fn dir(
let new_relative = relative.join(entry.file_name()); let new_relative = relative.join(entry.file_name());
if meta.is_dir() { if meta.is_dir() {
dir_tasks.push(dir(cfg, ctx, tpl, new_relative)); dir_tasks.push(dir(cfg, env, new_relative));
} else if meta.is_file() { } else if meta.is_file() {
file_tasks.push(file(cfg, ctx, tpl, new_relative)); file_tasks.push(file(cfg, env, new_relative));
} }
} }
@ -99,16 +92,11 @@ async fn dir(
} }
} }
async fn file( async fn file(cfg: &Config, env: &Env, relative: PathBuf) -> Result<(), Error> {
cfg: &Config,
ctx: &StandardContext,
tpl: &Templar,
relative: PathBuf,
) -> Result<(), Error> {
let template_path = cfg.template_dir.join(&relative); let template_path = cfg.template_dir.join(&relative);
let mut new_path = cfg.build_dir.join(&relative); let mut new_path = cfg.build_dir.join(&relative);
info!("rendering {:?}", template_path); debug!("rendering {:?}", template_path);
if template_path.extension() == Some(OsStr::new(TEMPLATE_EXTENSION)) { if template_path.extension() == Some(OsStr::new(TEMPLATE_EXTENSION)) {
// perform templating // perform templating
@ -116,11 +104,13 @@ async fn file(
.await .await
.with_location(&template_path)?; .with_location(&template_path)?;
let rendered = tpl let mut rendered = Vec::<u8>::new();
.parse_template(&file_str) parse_file(&file_str)
.map_err(|_| InnerError::TemplateParseErr)
.with_location(&template_path)? .with_location(&template_path)?
.render(ctx) .write(&env, &mut rendered)
.with_location(&template_path)?; .with_location(&template_path)?;
let rendered = std::str::from_utf8(&rendered).unwrap();
// remove template file extension // remove template file extension
new_path.set_extension(""); new_path.set_extension("");
@ -129,7 +119,7 @@ async fn file(
write(&new_path, &rendered).await.with_location(&new_path)?; write(&new_path, &rendered).await.with_location(&new_path)?;
} else { } else {
// else just copy the file // else just copy the file
info!("copying {:?}", template_path); debug!("copying {:?}", template_path);
copy(&template_path, &new_path) copy(&template_path, &new_path)
.await .await
.with_location(&template_path)?; .with_location(&template_path)?;

View File

@ -1,6 +1,6 @@
use compound_error::CompoundError;
use std::io; use std::io;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use thiserror::Error;
#[derive(Default)] #[derive(Default)]
pub struct Errors { pub struct Errors {
@ -12,10 +12,13 @@ pub struct Error {
inner: InnerError, inner: InnerError,
} }
#[derive(CompoundError, Debug)] #[derive(Debug, Error)]
pub enum InnerError { pub enum InnerError {
IoErr(io::Error), #[error("IO Error: {0}")]
TemplateErr(templar::TemplarError), IoErr(#[from] io::Error),
#[error("Failed to parse template file")]
TemplateParseErr,
} }
impl From<Vec<Error>> for Errors { impl From<Vec<Error>> for Errors {
@ -51,8 +54,8 @@ impl Errors {
error!("{} errors occured:", self.errors.len()); error!("{} errors occured:", self.errors.len());
for (i, error) in self.errors.iter().enumerate() { for (i, error) in self.errors.iter().enumerate() {
error!("{:.2}. {:?}", i, error.location); error!(" err {:02} at {:?}:", i, error.location);
error!(" {:?}", error.inner); error!(" {}", error.inner);
} }
} }
} }

View File

@ -67,13 +67,13 @@ async fn file(cfg: &Config, relative: PathBuf) -> Result<(), Error> {
match remove_file(&link_path).await { match remove_file(&link_path).await {
Ok(_) => { Ok(_) => {
info!("removed existing file {:?}", link_path); debug!("removed existing file {:?}", link_path);
} }
Err(e) if e.kind() == ErrorKind::NotFound => {} Err(e) if e.kind() == ErrorKind::NotFound => {}
Err(e) => return Err(e.with_location(&link_path)), Err(e) => return Err(e.with_location(&link_path)),
}; };
info!("linking {:?} to {:?}", link_path, build_path); debug!("linking {:?} to {:?}", link_path, build_path);
let symlink_content = if build_path.is_absolute() { let symlink_content = if build_path.is_absolute() {
build_path build_path
} else { } else {

View File

@ -24,11 +24,10 @@ struct Opt {
#[structopt(short, long)] #[structopt(short, long)]
link_dir: Option<PathBuf>, link_dir: Option<PathBuf>,
#[structopt(subcommand)]
color: Option<ColorMode>,
#[structopt(short, parse(from_occurrences))] #[structopt(short, parse(from_occurrences))]
verbosity: u8, verbosity: u8,
flags: Vec<String>,
} }
#[derive(Debug)] #[derive(Debug)]
@ -36,13 +35,7 @@ pub struct Config {
template_dir: PathBuf, template_dir: PathBuf,
build_dir: PathBuf, build_dir: PathBuf,
link_dir: PathBuf, link_dir: PathBuf,
color: ColorMode, flags: Vec<String>,
}
#[derive(StructOpt, PartialEq, Eq, Clone, Copy, Debug)]
pub enum ColorMode {
Dark,
Light,
} }
#[tokio::main] #[tokio::main]
@ -79,7 +72,7 @@ async fn run() -> Result<(), Errors> {
link_dir: opt link_dir: opt
.link_dir .link_dir
.unwrap_or_else(|| env::var("HOME").expect("$HOME").into()), .unwrap_or_else(|| env::var("HOME").expect("$HOME").into()),
color: opt.color.unwrap_or(ColorMode::Dark), flags: opt.flags,
}; };
info!("building tree"); info!("building tree");

View File

@ -23,13 +23,13 @@ window:
# The FreeType rasterizer needs to know the device DPI for best results # The FreeType rasterizer needs to know the device DPI for best results
# (changes require restart) # (changes require restart)
dpi: dpi:
{% if hostname == 'vostok' %} {% if hostname == "vostok" %}
x: 209.9 x: 209.9
y: 209.9 y: 209.9
{% else %} {% else %}
x: 96.0 x: 96.0
y: 96.0 y: 96.0
{% end if %} {% end %}
# When true, bold text is drawn using the bright variant of colors. # When true, bold text is drawn using the bright variant of colors.
draw_bold_text_with_bright_colors: true draw_bold_text_with_bright_colors: true
@ -37,46 +37,46 @@ draw_bold_text_with_bright_colors: true
# Font configuration (changes require restart) # Font configuration (changes require restart)
font: font:
normal: normal:
{% if hostname == 'sputnik' %} {% if hostname == "sputnik" %}
family: SauceCodePro Nerd Font family: SauceCodePro Nerd Font
{% else if hostname == 'vostok' %} {% elif hostname == "vostok" %}
family: Source Code Pro for Powerline family: Source Code Pro for Powerline
{% else %} {% else %}
family: monospace family: monospace
{% end if %} {% end %}
style: Regular style: Regular
bold: bold:
{% if hostname == 'sputnik' %} {% if hostname == "sputnik" %}
family: SauceCodePro Nerd Font family: SauceCodePro Nerd Font
{% else if hostname == 'vostok' %} {% elif hostname == "vostok" %}
family: Source Code Pro for Powerline family: Source Code Pro for Powerline
{% else %} {% else %}
family: monospace family: monospace
{% end if %} {% end %}
style: Bold style: Bold
italic: italic:
{% if hostname == 'sputnik' %} {% if hostname == "sputnik" %}
family: SauceCodePro Nerd Font family: SauceCodePro Nerd Font
{% else if hostname == 'vostok' %} {% elif hostname == "vostok" %}
family: Source Code Pro for Powerline family: Source Code Pro for Powerline
{% else %} {% else %}
family: monospace family: monospace
{% end if %} {% end %}
style: Italic style: Italic
# Point size of the font # Point size of the font
{% if hostname == 'sputnik' %} {% if hostname == "sputnik" %}
size: 11.0 size: 11.0
{% else if hostname == 'vostok' %} {% elif hostname == "vostok" %}
size: 10.0 size: 10.0
{% else %} {% else %}
size: 11.0 size: 11.0
{% end if %} {% end %}
# Offset is the extra space around each character. offset.y can be thought of # Offset is the extra space around each character. offset.y can be thought of
# as modifying the linespacing, and offset.x as modifying the letter spacing. # as modifying the linespacing, and offset.x as modifying the letter spacing.
@ -92,7 +92,7 @@ debug:
#background_opacity: 0.91 #background_opacity: 0.91
background_opacity: 1.0 background_opacity: 1.0
{% if lightmode %} {% if light %}
# Colors (Gruvbox light) # Colors (Gruvbox light)
colors: colors:
# Default colors # Default colors
@ -123,9 +123,9 @@ colors:
magenta: '0x8f3f71' magenta: '0x8f3f71'
cyan: '0x427b58' cyan: '0x427b58'
white: '0x3c3836' white: '0x3c3836'
{% end if %} {% end %}
{% if darkmode %} {% if dark %}
# Colors (Gruvbox dark) # Colors (Gruvbox dark)
colors: colors:
# Default colors # Default colors
@ -156,7 +156,7 @@ colors:
magenta: '0xd3869b' magenta: '0xd3869b'
cyan: '0x8ec07c' cyan: '0x8ec07c'
white: '0xebdbb2' white: '0xebdbb2'
{% end if %} {% end %}
# Visual Bell # Visual Bell
# #

View File

@ -66,13 +66,11 @@ if (match($TERM, "-256color") != -1) && (match($TERM, "screen-256color") == -1)
endif endif
let base16colorspace=256 let base16colorspace=256
{% if darkmode %} {% if light %}
colorscheme base16-gruvbox-dark-hard
{% end if %}
{% if lightmode %}
colorscheme base16-gruvbox-light-hard colorscheme base16-gruvbox-light-hard
{% end if %} {% else %}
colorscheme base16-gruvbox-dark-hard
{% end %}
" brighter comments " brighter comments
call Base16hi("Comment", g:base16_gui09, "", g:base16_cterm09, "", "", "") call Base16hi("Comment", g:base16_gui09, "", g:base16_cterm09, "", "", "")