diff --git a/Cargo.lock b/Cargo.lock index d24a30c..39a7bc6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -83,15 +83,6 @@ name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "chashmap" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "chrono" version = "0.4.13" @@ -138,14 +129,6 @@ dependencies = [ "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "crossbeam-channel" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "crossbeam-channel" version = "0.4.3" @@ -189,15 +172,6 @@ dependencies = [ "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "crossbeam-utils" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "crossbeam-utils" version = "0.7.2" @@ -244,26 +218,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "fsevent" -version = "0.4.0" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fsevent-sys 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fsevent-sys 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fsevent-sys" -version = "2.0.1" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.73 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -350,7 +319,7 @@ dependencies = [ [[package]] name = "inotify" -version = "0.7.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -486,18 +455,16 @@ dependencies = [ [[package]] name = "notify" -version = "5.0.0-pre.1" +version = "5.0.0-pre.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "anymap 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "chashmap 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "fsevent 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "fsevent-sys 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "inotify 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fsevent 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fsevent-sys 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "inotify 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.73 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.22 (registry+https://github.com/rust-lang/crates.io-index)", "mio-extras 2.0.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -527,46 +494,18 @@ name = "opaque-debug" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "owning_ref" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "stable_deref_trait 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "panres" version = "0.1.0" dependencies = [ "clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "notify 5.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)", + "notify 5.0.0-pre.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.114 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.56 (registry+https://github.com/rust-lang/crates.io-index)", "tera 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "parking_lot" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "parking_lot_core" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.73 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "parse-zoneinfo" version = "0.3.0" @@ -640,18 +579,6 @@ dependencies = [ "proc-macro2 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.73 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand" version = "0.7.3" @@ -673,19 +600,6 @@ dependencies = [ "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "rand_core" version = "0.5.1" @@ -702,14 +616,6 @@ dependencies = [ "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "redox_syscall" version = "0.1.57" @@ -788,19 +694,6 @@ dependencies = [ "deunicode 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "smallvec" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "strsim" version = "0.8.0" @@ -1005,26 +898,22 @@ dependencies = [ "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum chashmap 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ff41a3c2c1e39921b9003de14bf0439c7b63a9039637c291e1a64925d8ddfa45" "checksum chrono 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "c74d84029116787153e02106bf53e66828452a4b325cc8652b788b5967c0a0b6" "checksum chrono-tz 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "65d96be7c3e993c9ee4356442db24ba364c924b6b8331866be6b6952bfe74b9d" "checksum clap 2.33.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bdfa80d47f954d53a35a64987ca1422f495b8d6483c0fe9f7117b36c2a792129" "checksum crossbeam 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e" -"checksum crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c8ec7fcd21571dc78f96cc96243cab8d8f035247c3efd16c687be154c3fa9efa" "checksum crossbeam-channel 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "09ee0cc8804d5393478d743b035099520087a5186f3b93fa58cec08fa62407b6" "checksum crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" "checksum crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" "checksum crossbeam-queue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" -"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" "checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" "checksum deunicode 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690" "checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum filetime 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "affc17579b132fc2461adf7c575cc6e8b134ebca52c51f5411388965227dc695" "checksum fnv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -"checksum fsevent 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" -"checksum fsevent-sys 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0" -"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +"checksum fsevent 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "97f347202c95c98805c216f9e1df210e8ebaec9fdb2365700a43c10797a35e63" +"checksum fsevent-sys 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77a29c77f1ca394c3e73a9a5d24cfcabb734682d9634fc398f2204a63c994120" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" @@ -1034,7 +923,7 @@ dependencies = [ "checksum hermit-abi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" "checksum humansize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6cab2627acfc432780848602f3f558f7e9dd427352224b0d9324025796d2a5e" "checksum ignore 0.4.16 (registry+https://github.com/rust-lang/crates.io-index)" = "22dcbf2a4a289528dbef21686354904e1c694ac642610a9bff9e7df730d9ec72" -"checksum inotify 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f" +"checksum inotify 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "46dd0a94b393c730779ccfd2a872b67b1eb67be3fc33082e733bdb38b5fde4d4" "checksum inotify-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e74a1aa87c59aeff6ef2cc2fa62d41bc43f54952f55652656b18a02fd5e356c0" "checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" "checksum itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" @@ -1051,13 +940,10 @@ dependencies = [ "checksum mio-extras 2.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum net2 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)" = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" -"checksum notify 5.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d742ae493f34bd2e20ec2f3c1276fc1981343a8efd7ef12bca4368d0303bed50" +"checksum notify 5.0.0-pre.3 (registry+https://github.com/rust-lang/crates.io-index)" = "77d03607cf88b4b160ba0e9ed425fff3cee3b55ac813f0c685b3a3772da37d0e" "checksum num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" "checksum num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" "checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" -"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" -"checksum parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e" -"checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa" "checksum parse-zoneinfo 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c705f256449c60da65e11ff6626e0c16a0a0b96aaa348de61376b249bc340f41" "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" "checksum pest 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" @@ -1067,14 +953,10 @@ dependencies = [ "checksum ppv-lite86 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" "checksum proc-macro2 1.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" "checksum quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" -"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" "checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" "checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" "checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum regex 1.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" "checksum regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)" = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" @@ -1086,8 +968,6 @@ dependencies = [ "checksum sha-1 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" "checksum slug 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373" -"checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" -"checksum stable_deref_trait 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum syn 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "fb7f4c519df8c117855e19dd8cc851e89eb746fe7a73f0157e0d95fdec5369b0" "checksum tera 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "55df25c7768a0fb9f165931366eb0f21587c407061e1e69c1f5c2b495adfd9bb" diff --git a/Cargo.toml b/Cargo.toml index 6cdd6b4..3b562a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,5 +9,5 @@ tera = "1.0.0-beta.13" clap = "2" serde = "1" serde_json = "1.0" -notify = "=5.0.0-pre.1" +notify = "5.0.0-pre.3" crossbeam = "0.7" diff --git a/src/main.rs b/src/main.rs index 3222223..cb37652 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,13 +4,10 @@ use clap::{crate_authors, crate_version, App, AppSettings, Arg}; use crossbeam::crossbeam_channel::unbounded; use notify::{RecommendedWatcher, RecursiveMode, Watcher}; use serde_json::{from_str, Value}; -use std::{ - env, - error::Error, - fs::{create_dir_all, read_dir, read_to_string, write}, - process, - time::Duration, -}; +use std::env; +use std::error::Error; +use std::fs::{create_dir_all, read_dir, read_to_string, write}; +use std::process; use tera::{Context, Error as TeraError, Tera}; const DEFAULT_TEMPLATE_DIR: &str = "templates"; @@ -32,13 +29,13 @@ fn env_or_default(env_name: &str, default: &str) -> String { fn run() -> Result<(), Box> { let config: Value = from_str(&read_to_string("config.json")?)?; - let template_dir = &env_or_default("PANRES_TEMPLATE_DIR", DEFAULT_TEMPLATE_DIR); - let output_dir = &env_or_default("PANRES_OUTPUT_DIR", DEFAULT_OUTPUT_DIR); + let template_dir = env_or_default("PANRES_TEMPLATE_DIR", DEFAULT_TEMPLATE_DIR); + let output_dir = env_or_default("PANRES_OUTPUT_DIR", DEFAULT_OUTPUT_DIR); let matches = get_args(); - let tera = &mut Tera::new(&format!("{}/**/*", template_dir))?; - let context = &mut Context::new(); + let tera = Tera::new(&format!("{}/**/*", template_dir))?; + let mut context = Context::new(); context.insert("config", &config); let outputs: Vec = matches .values_of("output-format") @@ -46,11 +43,13 @@ fn run() -> Result<(), Box> { .map(String::from) .collect(); + output(&tera, &context, &output_dir, &outputs, &template_dir)?; + if matches.is_present("watch") { - watch_mode(tera, context, output_dir, &outputs, template_dir) - } else { - output(tera, context, output_dir, &outputs, template_dir) + watch_mode(tera, context, output_dir, outputs, template_dir)?; } + + Ok(()) } /// Returns the args passed by the user. @@ -73,26 +72,29 @@ fn get_args() -> clap::ArgMatches<'static> { /// Usually never returns, unless there was an error initializing the watcher. /// Handles watching for file changes, and reloads tera if there's a change. fn watch_mode<'a>( - engine: &mut Tera, - context: &mut Context, - dir: &str, - outputs: &[String], - template_dir: &'a str, + mut engine: Tera, + context: Context, + dir: String, + outputs: Vec, + template_dir: String, ) -> Result<(), Box> { let (tx, rx) = unbounded(); - let mut watcher: RecommendedWatcher = Watcher::new(tx, Duration::from_secs(2))?; - watcher.watch(template_dir, RecursiveMode::Recursive)?; + let mut watcher: RecommendedWatcher = Watcher::new_immediate(move |res| tx.send(res).unwrap())?; + watcher.watch(&template_dir, RecursiveMode::Recursive)?; - loop { - match rx.recv() { + for res in rx { + match res { Err(e) => println!("{}", e), Ok(event) => { println!("got event {:?}", event); - engine.full_reload()?; - output(engine, context, dir, outputs, template_dir)?; + engine.full_reload().expect("Failed to perform full reload"); + output(&engine, &context, &dir, &outputs, &template_dir) + .expect("Failed to call output"); } } } + + Ok(()) } /// Parses the output values and generates a file for each format specified or @@ -122,7 +124,7 @@ fn write_file(engine: &Tera, context: &Context, dir: &str, format: &str) -> Resu create_dir_all(dir).expect("Could not create output dir"); write( format!("{}/{}", dir, format), - engine.render(format, context.clone())?, + engine.render(format, context)?, ) .expect("to be able to write to output folder"); Ok(()) diff --git a/templates/latex b/templates/latex index 3ad1ace..d8d4a47 100644 --- a/templates/latex +++ b/templates/latex @@ -12,9 +12,9 @@ % macros which are illegal in .sty (primarily just font awesome stuff) -{% raw %} +{% raw -%} \newcommand{\glyph}[1]{{\fa\symbol{#1}}} -{% endraw %} +{% endraw -%} \renewcommand{\bullet}{ \ \ \raisebox{1.5pt}{\tiny\glyph{"F054}}} @@ -25,9 +25,9 @@ \arrayrulecolor{red} \setlength\arrayrulewidth{1.2pt} \begin{tabularx}{\textwidth}{l X r} -{% raw %} +{% raw -%} \name && \large\title{% -{% endraw %} +{% endraw -%} {{ config.available.start }}—{{ config.available.end }}} \\[-2pt] \end{tabularx} @@ -40,19 +40,19 @@ \begin{tabularx}{\textwidth}{ c | r X r } \sectiontitle{Education} -{% raw %} +{% raw -%} & \widel{ {\large\title{% -{% endraw %} +{% endraw -%} {{ config.education.school }}}}\hint{ {{ config.education.location }}}} & {{ config.education.start }}---{{ config.education.end_date }} \\ & \widel{\footnotesize {{ config.education.college }}} \\ {% for row in config.education.list -%} -{% raw %} +{% raw -%} & \hint{% -{% endraw %} +{% endraw -%} {{ row.name | title }}:} & -{% raw %} +{% raw -%} \multicolumn{2}{X}{% -{% endraw %} +{% endraw -%} {{ row.desc }}} \\ {% endfor -%} @@ -61,16 +61,16 @@ \sectiontitle{Skills} {% for row in config.skills -%} & \hint{ {{ row.name | title }}:} & -{% raw %} +{% raw -%} \multicolumn{2}{X}{% -{% endraw %} +{% endraw -%} {% if row.name == "languages" -%} \multirow{3}{*}{ \begin{tabularx}{\textwidth}{ r l } {% for group in row.desc -%} -{% raw %} +{% raw -%} \hint{% -{% endraw %} +{% endraw -%} {{ group.level | title }}:} & {{ group.langs }} \\ {% endfor -%} \end{tabularx} @@ -85,16 +85,16 @@ \begin{tabularx}{\textwidth}{c | r X r } \sectiontitle{Experience} {% for experience in config.experiences -%} -{% raw %} +{% raw -%} & \widel{\large\title{% -{% endraw %} +{% endraw -%} {{ experience.title }}}\hint{ {{experience.company }} }} & {{ experience.start }}---{{ experience.end }} \\ & \widel{\footnotesize {{ experience.location }}} \\ {% for note in experience.notes -%} & \bullet -{% raw %} +{% raw -%} & \widex{% -{% endraw %} +{% endraw -%} {{note}}} \\ {% endfor -%} {% endfor -%} @@ -103,15 +103,15 @@ \begin{tabularx}{\textwidth}{c | r X r } \sectiontitle{Projects} {% for project in config.projects -%} -{% raw %} +{% raw -%} & \widel{\large\title{% -{% endraw %} +{% endraw -%} {{ project.name }}}\hint{ {{ project.lang }} }} \\ {% for note in project.notes -%} & \bullet -{% raw %} +{% raw -%} & \widex{% -{% endraw %} +{% endraw -%} {{note}}} \\ {% endfor -%} {% endfor -%}