diff --git a/Cargo.lock b/Cargo.lock index a6cf072b..fd83dd58 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,30 +3,36 @@ version = 3 [[package]] -name = "aho-corasick" -version = "0.5.3" +name = "addr2line" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" +checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" dependencies = [ - "memchr 0.1.11", + "gimli", ] +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "aho-corasick" -version = "0.6.4" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4" +checksum = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" dependencies = [ - "memchr 2.3.0", + "memchr 0.1.11", ] [[package]] name = "aho-corasick" -version = "0.7.8" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "743ad5a418686aad3b87fd14c43badd828cf26e214a00f92a384291cf22e1811" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" dependencies = [ - "memchr 2.3.0", + "memchr 2.4.1", ] [[package]] @@ -42,26 +48,18 @@ dependencies = [ "git2", "lazy_static", "libc", + "linked-hash-map", "luthor", "mio", "regex 0.1.80", - "regex 1.3.4", + "regex 1.5.4", "scribe", "signal-hook", "smallvec", "syntect", "termion", "unicode-segmentation", - "yaml-rust", -] - -[[package]] -name = "ansi_term" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -dependencies = [ - "winapi 0.3.5", + "yaml-rust 0.4.5 (git+https://github.com/lincolnauster/yaml-rust?branch=all)", ] [[package]] @@ -76,44 +74,36 @@ dependencies = [ "xdg", ] -[[package]] -name = "arc-swap" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc4662175ead9cd84451d5c35070517777949a2ed84551764129cedb88384841" - [[package]] name = "atty" -version = "0.2.10" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fc4a1aa4c24c0718a250f0681885c1af91419d242f29eb8f2ab28502d80dbd1" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ + "hermit-abi", "libc", - "termion", - "winapi 0.3.5", + "winapi 0.3.9", ] [[package]] -name = "backtrace" -version = "0.3.8" +name = "autocfg" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbdd17cd962b570302f5297aea8648d5923e22e555c2ed2d8b2e34eca646bf6d" -dependencies = [ - "backtrace-sys", - "cfg-if", - "libc", - "rustc-demangle", - "winapi 0.3.5", -] +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] -name = "backtrace-sys" -version = "0.1.23" +name = "backtrace" +version = "0.3.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff67d0c06556c0b8e6b5f090f0eac52d950d9dfd1d35ba04e4ca3543eaf6a7e" +checksum = "321629d8ba6513061f26707241fa9bc89524ff1cd7a915a97ef0c62c666ce1b6" dependencies = [ + "addr2line", "cc", + "cfg-if 1.0.0", "libc", + "miniz_oxide", + "object", + "rustc-demangle", ] [[package]] @@ -128,19 +118,18 @@ dependencies = [ [[package]] name = "bincode" -version = "1.0.1" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f2fb9e29e72fd6bc12071533d5dc7664cb01480c59406f656d7ac25c7bd8ff7" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" dependencies = [ - "byteorder", "serde", ] [[package]] name = "bitflags" -version = "1.1.0" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "block" @@ -160,67 +149,75 @@ dependencies = [ ] [[package]] -name = "byteorder" -version = "1.2.3" +name = "bstr" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74c0b906e9446b0a2e4f760cdb3fa4b2c48cdc6db8766a845c54b6ff063fd2e9" +checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +dependencies = [ + "lazy_static", + "memchr 2.4.1", + "regex-automata", + "serde", +] [[package]] -name = "bytes" -version = "0.4.8" +name = "byteorder" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd32989a66957d3f0cba6588f15d4281a733f4e9ffc43fcd2385f57d3bf99ff" -dependencies = [ - "byteorder", - "iovec", -] +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cast" -version = "0.2.2" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427" +checksum = "4c24dab4283a142afa2fdca129b80ad2c6284e073930f964c3a1293c225ee39a" +dependencies = [ + "rustc_version", +] [[package]] name = "cc" -version = "1.0.45" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc9a35e1f4290eb9e5fc54ba6cf40671ed2a2514c3eeb2b2a908dda2ea5a1be" +checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" dependencies = [ "jobserver", - "num_cpus", ] [[package]] name = "cfg-if" -version = "0.1.3" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "405216fd8fe65f718daa7102ea808a946b6ce40c742998fbfd3463645552de18" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.2" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cce36c92cb605414e9b824f866f5babe0a0368e39ea07393b9b63cf3844c0e6" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ + "libc", "num-integer", - "num-traits 0.2.4", + "num-traits", "time", + "winapi 0.3.9", ] [[package]] name = "clap" -version = "2.31.2" +version = "2.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ - "ansi_term", - "atty", "bitflags", - "strsim", "textwrap", "unicode-width", - "vec_map", ] [[package]] @@ -238,49 +235,63 @@ dependencies = [ [[package]] name = "clipboard-win" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "289da2fc09ab964a4948a63287c94fcb4698fa823c46da84c3792928c9d36110" +checksum = "e3a093d6fed558e5fe24c3dfc85a68bb68f1c824f440d3ba5aca189e2998786b" dependencies = [ - "winapi 0.3.5", + "winapi 0.3.9", ] [[package]] -name = "cmake" -version = "0.1.31" +name = "cloudabi" +version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95470235c31c726d72bf2e1f421adc1e65b9d561bf5529612cbe1a72da1467b3" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "cc", + "bitflags", +] + +[[package]] +name = "crc32fast" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836" +dependencies = [ + "cfg-if 1.0.0", ] [[package]] name = "criterion" -version = "0.2.3" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f11151e2961d0483e5eb7a2ede5ed8071a460d04d2b7c89e8257aa5502b0e0b" +checksum = "0363053954f3e679645fc443321ca128b7b950a6fe288cf5f9335cc22ee58394" dependencies = [ "atty", + "cast", "clap", "criterion-plot", - "criterion-stats", - "failure", - "failure_derive", - "handlebars", + "csv", "itertools", - "itertools-num", - "log", + "lazy_static", + "libc", + "num-traits", + "rand_core 0.3.1", + "rand_os", + "rand_xoshiro", + "rayon", + "rayon-core", "serde", "serde_derive", "serde_json", - "simplelog", + "tinytemplate", + "walkdir", ] [[package]] name = "criterion-plot" -version = "0.2.3" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7f7c88a8d341dd9fd9e31a72ca2ca24428db79afb491852873b2c784e037e6" +checksum = "76f9212ddf2f4a9eb2d401635190600656a1f88a932ef53d06e7fa4c7e02fb8e" dependencies = [ "byteorder", "cast", @@ -288,41 +299,96 @@ dependencies = [ ] [[package]] -name = "criterion-stats" -version = "0.2.3" +name = "crossbeam-channel" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd48feb0253b2968ff3085e7f3fba6738c9ff859f420a2fb81a48986eb66da36" +checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa" dependencies = [ - "cast", - "num-traits 0.2.4", - "num_cpus", - "rand", - "thread-scoped", + "cfg-if 1.0.0", + "crossbeam-utils", ] [[package]] -name = "dtoa" -version = "0.4.2" +name = "crossbeam-deque" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab" +checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-epoch", + "crossbeam-utils", +] [[package]] -name = "duct" -version = "0.10.0" +name = "crossbeam-epoch" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97242a70df9b89a65d0b6df3c4bf5b9ce03c5b7309019777fbde37e7537f8762" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", + "lazy_static", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcae03edb34f947e64acdb1c33ec169824e20657e9ecb61cef6c8c74dcb8120" +dependencies = [ + "cfg-if 1.0.0", + "lazy_static", +] + +[[package]] +name = "csv" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "166298c17c5b4fe5997b962c2f22e887c7c5adc44308eb9103ce5b66af45a423" +checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" +dependencies = [ + "bstr", + "csv-core", + "itoa 0.4.8", + "ryu", + "serde", +] + +[[package]] +name = "csv-core" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +dependencies = [ + "memchr 2.4.1", +] + +[[package]] +name = "dirs" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" dependencies = [ - "lazycell 0.6.0", "libc", - "os_pipe", - "shared_child", + "redox_users", + "winapi 0.3.9", ] [[package]] name = "either" -version = "1.5.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "error-chain" @@ -353,48 +419,45 @@ dependencies = [ ] [[package]] -name = "failure" -version = "0.1.1" +name = "flate2" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "934799b6c1de475a012a02dab0ace1ace43789ee4b99bcfbf1a2e3e8ced5de82" +checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" dependencies = [ - "backtrace", - "failure_derive", + "cfg-if 1.0.0", + "crc32fast", + "libc", + "miniz_oxide", ] [[package]] -name = "failure_derive" -version = "0.1.1" +name = "fnv" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7cdda555bb90c9bb67a3b670a0f42de8e73f5981524123ad8578aafec8ddb8b" -dependencies = [ - "quote 0.3.15", - "syn 0.11.11", - "synstructure", -] +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "flate2" +name = "form_urlencoded" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fac2277e84e5e858483756647a9d0aa8d9a2b7cba517fd84325a0aaa69a0909" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ - "libc", - "miniz-sys", + "matches", + "percent-encoding", ] -[[package]] -name = "fnv" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" - [[package]] name = "fragment" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed2593535a2bf81d7d008c153027c08fdfce2dcca920ba6f345a59d8754cb3" +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -411,28 +474,28 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -[[package]] -name = "gcc" -version = "0.3.54" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb" - [[package]] name = "getrandom" -version = "0.1.12" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "473a1265acc8ff1e808cd0a1af8cee3c2ee5200916058a2ca113c29f2d903571" +checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "libc", "wasi", ] +[[package]] +name = "gimli" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" + [[package]] name = "git2" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39f27186fbb5ec67ece9a56990292bc5aed3c3fc51b9b07b0b52446b1dfb4a82" +checksum = "7c1af51ea8a906616af45a4ce78eacf25860f7a13ae7bf8a814693f0f4037a26" dependencies = [ "bitflags", "libc", @@ -448,26 +511,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] -name = "handlebars" -version = "0.31.0" +name = "hermit-abi" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7bdb08e879b8c78ee90f5022d121897c31ea022cb0cc6d13f2158c7a9fbabb1" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ - "lazy_static", - "log", - "pest", - "pest_derive", - "quick-error", - "regex 0.2.11", - "serde", - "serde_json", + "libc", ] [[package]] name = "idna" -version = "0.2.0" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" dependencies = [ "matches", "unicode-bidi", @@ -476,47 +532,41 @@ dependencies = [ [[package]] name = "iovec" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" dependencies = [ "libc", - "winapi 0.2.8", ] [[package]] name = "itertools" -version = "0.7.8" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f58856976b776fedd95533137617a02fb25719f40e7d9b01c7043cd65474f450" +checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" dependencies = [ "either", ] [[package]] -name = "itertools-num" -version = "0.1.1" +name = "itoa" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d78fa608383e6e608ba36f962ac991d5d6878d7203eb93b4711b14fa6717813" -dependencies = [ - "num-traits 0.1.43", -] +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "0.4.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c069bbec61e1ca5a596166e55dfe4773ff745c3d16b700013bcaff9a6df2c682" +checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" [[package]] name = "jobserver" -version = "0.1.17" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b1d42ef453b30b7387e113da1c83ab1605d90c5b4e0eb8e96d016ed3b8c160" +checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" dependencies = [ - "getrandom", "libc", - "log", ] [[package]] @@ -531,33 +581,21 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" - -[[package]] -name = "lazycell" -version = "0.6.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef" - -[[package]] -name = "lazycell" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.62" +version = "0.2.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba" +checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" [[package]] name = "libgit2-sys" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a30f8637eb59616ee3b8a00f6adff781ee4ddd8343a615b8238de756060cc1b3" +checksum = "4870c781f6063efb83150cd22c1ddf6ecf58531419e7570cdcced46970f64a16" dependencies = [ "cc", "libc", @@ -567,9 +605,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.0.25" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" +checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66" dependencies = [ "cc", "libc", @@ -585,11 +623,11 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] name = "log" -version = "0.4.8" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -609,9 +647,9 @@ dependencies = [ [[package]] name = "matches" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "memchr" @@ -624,31 +662,40 @@ dependencies = [ [[package]] name = "memchr" -version = "2.3.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3197e20c7edb283f87c071ddfc7a2cca8f8e0b888c242959846a6fce03c72223" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] -name = "miniz-sys" -version = "0.1.10" +name = "memoffset" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ - "cc", - "libc", + "autocfg", +] + +[[package]] +name = "miniz_oxide" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +dependencies = [ + "adler", + "autocfg", ] [[package]] name = "mio" -version = "0.6.16" +version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" dependencies = [ + "cfg-if 0.1.10", "fuchsia-zircon", "fuchsia-zircon-sys", "iovec", "kernel32-sys", - "lazycell 1.2.1", "libc", "log", "miow", @@ -657,22 +704,11 @@ dependencies = [ "winapi 0.2.8", ] -[[package]] -name = "mio-uds" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" -dependencies = [ - "iovec", - "libc", - "mio", -] - [[package]] name = "miow" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" dependencies = [ "kernel32-sys", "net2", @@ -682,67 +718,55 @@ dependencies = [ [[package]] name = "net2" -version = "0.2.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" -dependencies = [ - "cfg-if", - "libc", - "winapi 0.3.5", -] - -[[package]] -name = "nix" -version = "0.10.0" +version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7fd5681d13fda646462cfbd4e5f2051279a89a544d50eb98c365b507246839f" +checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" dependencies = [ - "bitflags", - "bytes", - "cfg-if", - "gcc", + "cfg-if 0.1.10", "libc", - "void", + "winapi 0.3.9", ] [[package]] name = "num-integer" -version = "0.1.38" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac0ea58d64a89d9d6b7688031b3be9358d6c919badcf7fbb0527ccfd891ee45" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "num-traits 0.2.4", + "autocfg", + "num-traits", ] [[package]] name = "num-traits" -version = "0.1.43" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "num-traits 0.2.4", + "autocfg", ] -[[package]] -name = "num-traits" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775393e285254d2f5004596d69bb8bc1149754570dcc08cf30cabeba67955e28" - [[package]] name = "num_cpus" -version = "1.10.1" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" dependencies = [ + "hermit-abi", "libc", ] +[[package]] +name = "numtoa" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" + [[package]] name = "objc" -version = "0.2.2" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877f30f37acef6749b1841cceab289707f211aecfc756553cd63976190e6cc2e" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" dependencies = [ "malloc_buf", ] @@ -760,13 +784,22 @@ dependencies = [ [[package]] name = "objc_id" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4730aa1c64d722db45f7ccc4113a3e2c465d018de6db4d3e7dfe031e8c8a297" +checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" dependencies = [ "objc", ] +[[package]] +name = "object" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" +dependencies = [ + "memchr 2.4.1", +] + [[package]] name = "ole32-sys" version = "0.2.0" @@ -791,54 +824,26 @@ dependencies = [ [[package]] name = "onig_sys" -version = "68.0.1" +version = "68.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6be7c4f985508684e54f18dd37f71e66f3e1ad9318336a520d7e42f0d3ea8e" +checksum = "195ebddbb56740be48042ca117b8fb6e0d99fe392191a9362d82f5f69e510379" dependencies = [ - "cmake", - "duct", + "cc", "libc", "pkg-config", ] -[[package]] -name = "os_pipe" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "934868c3f86ed7a39ef63d88edeac5bd49a0c843192651900e9ce1178cbbf157" -dependencies = [ - "nix", - "winapi 0.3.5", -] - [[package]] name = "percent-encoding" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -[[package]] -name = "pest" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fce5d8b5cc33983fc74f78ad552b5522ab41442c4ca91606e4236eb4b5ceefc" - -[[package]] -name = "pest_derive" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab94faafeb93f4c5e3ce81ca0e5a779529a602ad5d09ae6d21996bfb8b6a52bf" -dependencies = [ - "pest", - "quote 0.3.15", - "syn 0.11.11", -] - [[package]] name = "pkg-config" -version = "0.3.11" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "110d5ee3593dbb73f56294327fe5668bcc997897097cbc76b51e7aed3f52452f" +checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" [[package]] name = "plist" @@ -855,57 +860,120 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "0.4.6" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "effdb53b25cdad54f8f48843d67398f7ef2e14f12c1b4cb4effc549a6462a4d6" +checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" dependencies = [ - "unicode-xid 0.1.0", + "unicode-xid", ] -[[package]] -name = "quick-error" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" - [[package]] name = "quote" -version = "0.3.15" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" +checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d" +dependencies = [ + "proc-macro2", +] [[package]] -name = "quote" -version = "0.6.3" +name = "rand_core" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e44651a0dc4cdd99f71c83b561e221f714912d11af1a4dff0631f923d53af035" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" dependencies = [ - "proc-macro2", + "rand_core 0.4.2", ] [[package]] -name = "rand" +name = "rand_core" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" + +[[package]] +name = "rand_os" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" dependencies = [ - "fuchsia-zircon", + "cloudabi", + "fuchsia-cprng", "libc", - "winapi 0.3.5", + "rand_core 0.4.2", + "rdrand", + "winapi 0.3.9", +] + +[[package]] +name = "rand_xoshiro" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b418169fb9c46533f326efd6eed2576699c44ca92d3052a066214a8d828929" +dependencies = [ + "byteorder", + "rand_core 0.3.1", +] + +[[package]] +name = "rayon" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +dependencies = [ + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static", + "num_cpus", +] + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +dependencies = [ + "rand_core 0.3.1", ] [[package]] name = "redox_syscall" -version = "0.1.40" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" +checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +dependencies = [ + "bitflags", +] [[package]] name = "redox_termios" -version = "0.1.1" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" +dependencies = [ + "redox_syscall", +] + +[[package]] +name = "redox_users" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" dependencies = [ + "getrandom", "redox_syscall", ] @@ -918,34 +986,26 @@ dependencies = [ "aho-corasick 0.5.3", "memchr 0.1.11", "regex-syntax 0.3.9", - "thread_local 0.2.7", - "utf8-ranges 0.1.3", + "thread_local", + "utf8-ranges", ] [[package]] name = "regex" -version = "0.2.11" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" dependencies = [ - "aho-corasick 0.6.4", - "memchr 2.3.0", - "regex-syntax 0.5.6", - "thread_local 0.3.5", - "utf8-ranges 1.0.0", + "aho-corasick 0.7.18", + "memchr 2.4.1", + "regex-syntax 0.6.25", ] [[package]] -name = "regex" -version = "1.3.4" +name = "regex-automata" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322cf97724bea3ee221b78fe25ac9c46114ebb51747ad5babd51a2fc6a8235a8" -dependencies = [ - "aho-corasick 0.7.8", - "memchr 2.3.0", - "regex-syntax 0.6.14", - "thread_local 1.0.1", -] +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" [[package]] name = "regex-syntax" @@ -961,24 +1021,30 @@ checksum = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e" [[package]] name = "regex-syntax" -version = "0.5.6" +version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7" -dependencies = [ - "ucd-util", -] +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] -name = "regex-syntax" -version = "0.6.14" +name = "rustc-demangle" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b28dfe3fe9badec5dbf0a79a9cccad2cfc2ab5484bdb3e44cbd1ae8b3ba2be06" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" [[package]] -name = "rustc-demangle" -version = "0.1.8" +name = "rustc_version" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d7ba1feafada44f2d38eed812bd2489a03c0f5abb975799251518b68848649" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "ryu" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" [[package]] name = "safemem" @@ -988,13 +1054,19 @@ checksum = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" [[package]] name = "same-file" -version = "1.0.2" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfb6eded0b06a0b512c8ddbcf04089138c9b4362c2f696f3c3d76039d68f3637" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ - "winapi 0.3.5", + "winapi-util", ] +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + [[package]] name = "scribe" version = "0.7.2" @@ -1007,45 +1079,40 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "semver" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012" + [[package]] name = "serde" -version = "1.0.66" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9a2d9a9ac5120e0f768801ca2b58ad6eec929dc9d1d616c162f208869c2ce95" +checksum = "97565067517b60e2d1ea8b268e59ce036de907ac523ad83a0475da04e818989a" [[package]] name = "serde_derive" -version = "1.0.66" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a90213fa7e0f5eac3f7afe2d5ff6b088af515052cc7303bd68c7e3b91a3fb79" +checksum = "ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537" dependencies = [ "proc-macro2", - "quote 0.6.3", - "syn 0.14.2", + "quote", + "syn", ] [[package]] name = "serde_json" -version = "1.0.19" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93aee34bb692dde91e602871bc792dd319e489c7308cdbbe5f27cf27c64280f5" +checksum = "c059c05b48c5c0067d4b4b2b4f0732dd65feb52daf7e0ea09cd87e7dadc1af79" dependencies = [ - "dtoa", - "itoa", + "itoa 1.0.1", + "ryu", "serde", ] -[[package]] -name = "shared_child" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcd5e483b3475af9bc2a35311c2f3bbf0bd98fde91410ab15a0d4ba3c3127b4e" -dependencies = [ - "kernel32-sys", - "libc", - "winapi 0.2.8", -] - [[package]] name = "shell32-sys" version = "0.1.2" @@ -1058,42 +1125,29 @@ dependencies = [ [[package]] name = "signal-hook" -version = "0.1.9" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ab58f1fda436857e6337dcb6a5aaa34f16c5ddc87b3a8b6ef7a212f90b9c5a" +checksum = "7e31d442c16f047a671b5a71e2161d6e68814012b7f5379d269ebd915fac2729" dependencies = [ "libc", "mio", - "mio-uds", "signal-hook-registry", ] [[package]] name = "signal-hook-registry" -version = "1.0.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cded4ffa32146722ec54ab1f16320568465aa922aa9ab4708129599740da85d7" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" dependencies = [ - "arc-swap", "libc", ] -[[package]] -name = "simplelog" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cc12b39fdf4c9a07f88bffac2d628f0118ed5ac077a4b0feece61fadf1429e5" -dependencies = [ - "chrono", - "log", - "term", -] - [[package]] name = "slab" -version = "0.4.1" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9776d6b986f77b35c6cf846c11ad986ff128fe0b2b63a3628e3755e8d3102d" +checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" [[package]] name = "smallvec" @@ -1101,51 +1155,15 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90c5e5fe535e48807ab94fc611d323935f39d4660c52b26b96446a7b33aef10" -[[package]] -name = "strsim" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" - -[[package]] -name = "syn" -version = "0.11.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -dependencies = [ - "quote 0.3.15", - "synom", - "unicode-xid 0.0.4", -] - [[package]] name = "syn" -version = "0.14.2" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c67da57e61ebc7b7b6fff56bb34440ca3a83db037320b0507af4c10368deda7d" +checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7" dependencies = [ "proc-macro2", - "quote 0.6.3", - "unicode-xid 0.1.0", -] - -[[package]] -name = "synom" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" -dependencies = [ - "unicode-xid 0.0.4", -] - -[[package]] -name = "synstructure" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd" -dependencies = [ - "quote 0.3.15", - "syn 0.11.11", + "quote", + "unicode-xid", ] [[package]] @@ -1166,35 +1184,26 @@ dependencies = [ "serde_derive", "serde_json", "walkdir", - "yaml-rust", -] - -[[package]] -name = "term" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561" -dependencies = [ - "byteorder", - "winapi 0.3.5", + "yaml-rust 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "termion" -version = "1.5.1" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" +checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" dependencies = [ "libc", + "numtoa", "redox_syscall", "redox_termios", ] [[package]] name = "textwrap" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ "unicode-width", ] @@ -1209,12 +1218,6 @@ dependencies = [ "libc", ] -[[package]] -name = "thread-scoped" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcbb6aa301e5d3b0b5ef639c9a9c7e2f1c944f177b460c04dc24c69b1fa2bd99" - [[package]] name = "thread_local" version = "0.2.7" @@ -1225,55 +1228,54 @@ dependencies = [ ] [[package]] -name = "thread_local" -version = "0.3.5" +name = "time" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963" +checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ - "lazy_static", - "unreachable", + "libc", + "winapi 0.3.9", ] [[package]] -name = "thread_local" -version = "1.0.1" +name = "tinytemplate" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ - "lazy_static", + "serde", + "serde_json", ] [[package]] -name = "time" -version = "0.1.40" +name = "tinyvec" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b" +checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" dependencies = [ - "libc", - "redox_syscall", - "winapi 0.3.5", + "tinyvec_macros", ] [[package]] -name = "ucd-util" -version = "0.1.1" +name = "tinyvec_macros" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "unicode-bidi" -version = "0.3.4" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -dependencies = [ - "matches", -] +checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" [[package]] name = "unicode-normalization" -version = "0.1.7" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +dependencies = [ + "tinyvec", +] [[package]] name = "unicode-segmentation" @@ -1283,37 +1285,23 @@ checksum = "3c5336c5173d8a77ae0b36151c706e32ae10f4985e29d704ad5b5f9565d6d4b6" [[package]] name = "unicode-width" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" - -[[package]] -name = "unicode-xid" -version = "0.0.4" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" [[package]] name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" - -[[package]] -name = "unreachable" -version = "1.0.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -dependencies = [ - "void", -] +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "url" -version = "2.1.0" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75b414f6c464c879d7f9babf951f23bc3743fb7313c081b2e6ca719067ea9d61" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" dependencies = [ + "form_urlencoded", "idna", "matches", "percent-encoding", @@ -1325,51 +1313,34 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" -[[package]] -name = "utf8-ranges" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122" - [[package]] name = "vcpkg" -version = "0.2.3" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ed0f6789c8a85ca41bbc1c9d175422116a9869bd1cf31bb08e1493ecce60380" - -[[package]] -name = "vec_map" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" - -[[package]] -name = "void" -version = "1.0.2" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.1.4" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63636bd0eb3d00ccb8b9036381b526efac53caf112b7783b730ab3f8e44da369" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" dependencies = [ "same-file", - "winapi 0.3.5", + "winapi 0.3.9", + "winapi-util", ] [[package]] name = "wasi" -version = "0.7.0" +version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "winapi" @@ -1379,9 +1350,9 @@ checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" -version = "0.3.5" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773ef9dcc5f24b7d850d0ff101e542ff24c3b090a9768e03ff889fdef41f00fd" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", @@ -1399,6 +1370,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -1437,9 +1417,12 @@ dependencies = [ [[package]] name = "xdg" -version = "2.1.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66b7c2281ebde13cf4391d70d4c7e5946c3c25e72a7b859ca8f677dcd0b0c61" +checksum = "3a23fe958c70412687039c86f578938b4a0bb50ec788e96bce4d6ab00ddd5803" +dependencies = [ + "dirs", +] [[package]] name = "xml-rs" @@ -1458,3 +1441,11 @@ checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" dependencies = [ "linked-hash-map", ] + +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "git+https://github.com/lincolnauster/yaml-rust?branch=all#19833b4d5bdc233e3aee682135be055506c41d62" +dependencies = [ + "linked-hash-map", +] diff --git a/Cargo.toml b/Cargo.toml index e0b54e19..ceb58bb3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,10 +28,12 @@ termion = "1.5.1" error-chain = "0.12.4" unicode-segmentation = "1.0.1" clipboard = "0.4.4" -yaml-rust = ">= 0.4.5" smallvec = "0.4.3" lazy_static = "1.2.0" mio = "0.6" +linked-hash-map = "0.5.4" + +yaml-rust = { git = "https://github.com/lincolnauster/yaml-rust", branch = "all" } [dependencies.signal-hook] version = "0.1.9" diff --git a/src/commands/application.rs b/src/commands/application.rs index 87028e28..5e748682 100644 --- a/src/commands/application.rs +++ b/src/commands/application.rs @@ -286,7 +286,7 @@ mod tests { #[test] fn display_available_commands_creates_a_new_buffer() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); super::display_available_commands(&mut app).unwrap(); assert!(app.workspace.current_buffer().is_some()); @@ -294,7 +294,7 @@ mod tests { #[test] fn display_available_commands_populates_new_buffer_with_alphabetic_command_names() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); super::display_available_commands(&mut app).unwrap(); let buffer_data = app.workspace.current_buffer().unwrap().data(); @@ -305,7 +305,7 @@ mod tests { #[test] fn switch_to_search_mode_sets_initial_search_query() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); // A buffer needs to be open to switch to search mode. let buffer = Buffer::new(); @@ -326,7 +326,7 @@ mod tests { #[test] fn switch_to_path_mode_inserts_workspace_directory_as_default() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let buffer = Buffer::new(); app.workspace.add_buffer(buffer); @@ -344,7 +344,7 @@ mod tests { #[test] fn switch_to_path_mode_inserts_buffer_path_if_one_exists() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); let absolute_path = format!("{}/test", app.workspace.path.to_string_lossy()); @@ -364,7 +364,7 @@ mod tests { #[test] fn switch_to_path_mode_raises_error_if_no_buffer_is_open() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); // The application type picks up on test run // arguments and will open empty buffers for each. diff --git a/src/commands/buffer.rs b/src/commands/buffer.rs index abcd1522..1d62864d 100644 --- a/src/commands/buffer.rs +++ b/src/commands/buffer.rs @@ -825,7 +825,7 @@ mod tests { #[test] fn insert_newline_uses_current_line_indentation() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); // Insert data with indentation and move to the end of the line. @@ -858,7 +858,7 @@ mod tests { #[test] fn insert_newline_uses_nearest_line_indentation_when_current_line_blank() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); // Insert data with indentation and move to the end of the line. @@ -891,7 +891,7 @@ mod tests { #[test] fn change_rest_of_line_removes_content_and_switches_to_insert_mode() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); // Insert data with indentation and move to the end of the line. @@ -926,7 +926,7 @@ mod tests { #[test] fn delete_token_deletes_current_token_and_trailing_whitespace() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp editor"); @@ -941,7 +941,7 @@ mod tests { #[test] fn delete_token_does_not_delete_newline_characters() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor"); @@ -956,7 +956,7 @@ mod tests { #[test] fn delete_current_line_deletes_current_line() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); // Insert data with indentation and move to the end of the line. @@ -978,7 +978,7 @@ mod tests { #[test] fn indent_line_inserts_two_spaces_at_start_of_line() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor"); buffer.cursor.move_to(Position { @@ -998,7 +998,7 @@ mod tests { #[test] fn indent_line_works_in_select_line_mode() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\n editor"); @@ -1016,7 +1016,7 @@ mod tests { #[test] fn indent_line_moves_cursor_in_insert_mode() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor"); buffer.cursor.move_to(Position { @@ -1040,7 +1040,7 @@ mod tests { #[test] fn indent_line_does_not_move_cursor_in_normal_mode() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor"); buffer.cursor.move_to(Position { @@ -1063,7 +1063,7 @@ mod tests { #[test] fn indent_line_groups_multi_line_indents_as_a_single_operation() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\n editor"); @@ -1086,7 +1086,7 @@ mod tests { #[test] fn indent_line_works_with_reversed_selections() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor"); @@ -1105,7 +1105,7 @@ mod tests { #[test] fn outdent_line_removes_two_spaces_from_start_of_line() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\n editor"); buffer.cursor.move_to(Position { @@ -1133,7 +1133,7 @@ mod tests { #[test] fn outdent_line_removes_as_much_space_as_it_can_from_start_of_line_if_less_than_full_indent () { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\n editor"); buffer.cursor.move_to(Position { @@ -1153,7 +1153,7 @@ mod tests { #[test] fn outdent_does_nothing_if_there_is_no_leading_whitespace() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); // Add some trailing whitespace to trip up naive implementations. @@ -1171,7 +1171,7 @@ mod tests { #[test] fn outdent_line_works_in_select_line_mode() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert(" amp\n editor"); @@ -1189,7 +1189,7 @@ mod tests { #[test] fn outdent_line_groups_multi_line_indents_as_a_single_operation() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert(" amp\n editor"); @@ -1212,7 +1212,7 @@ mod tests { #[test] fn outdent_line_works_with_reversed_selections() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert(" amp\n editor"); @@ -1231,7 +1231,7 @@ mod tests { #[test] fn remove_trailing_whitespace_works() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert(" amp\n \neditor "); @@ -1247,7 +1247,7 @@ mod tests { #[test] fn remove_trailing_whitespace_works_with_tab() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("\t\tamp\n\t\t\neditor\t"); @@ -1263,7 +1263,7 @@ mod tests { #[test] fn save_removes_trailing_whitespace_and_adds_newlines() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp \neditor "); @@ -1279,7 +1279,7 @@ mod tests { #[test] fn save_adds_newline_with_unicode() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp \n∴ editor "); app.workspace.add_buffer(buffer); @@ -1291,7 +1291,7 @@ mod tests { #[test] fn save_switches_to_path_mode_when_path_is_missing() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let buffer = Buffer::new(); // Now that we've set up the buffer, add it @@ -1308,7 +1308,7 @@ mod tests { #[test] fn save_sets_save_on_accept_when_switching_to_path_mode() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let buffer = Buffer::new(); // Now that we've set up the buffer, add it @@ -1326,7 +1326,7 @@ mod tests { #[test] fn paste_inserts_at_cursor_when_pasting_inline_data() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor"); @@ -1346,7 +1346,7 @@ mod tests { #[test] fn paste_inserts_on_line_below_when_pasting_block_data() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor"); buffer.cursor.move_to(Position { @@ -1369,7 +1369,7 @@ mod tests { #[test] fn paste_works_at_end_of_buffer_when_pasting_block_data() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor"); buffer.cursor.move_to(Position { @@ -1393,7 +1393,7 @@ mod tests { #[test] fn paste_works_on_trailing_newline_when_pasting_block_data() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor\n"); buffer.cursor.move_to(Position { @@ -1418,7 +1418,7 @@ mod tests { #[test] fn backspace_outdents_line_if_line_is_whitespace() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor\n "); buffer.cursor.move_to(Position { @@ -1438,7 +1438,7 @@ mod tests { #[test] fn merge_next_line_joins_current_and_next_lines_with_a_space() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor"); @@ -1460,7 +1460,7 @@ mod tests { #[test] fn merge_next_line_does_nothing_if_there_is_no_next_line() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp editor"); @@ -1482,7 +1482,7 @@ mod tests { #[test] fn merge_next_line_works_when_the_next_line_has_a_line_after_it() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor\ntest"); @@ -1498,7 +1498,7 @@ mod tests { #[test] fn merge_next_line_works_when_the_first_line_has_leading_whitespace() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("\n amp\neditor"); buffer.cursor.move_to(Position { @@ -1518,7 +1518,7 @@ mod tests { #[test] fn merge_next_line_removes_leading_whitespace_from_second_line() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\n editor"); @@ -1533,7 +1533,7 @@ mod tests { #[test] fn ensure_trailing_newline_adds_newlines_when_missing() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor"); @@ -1549,7 +1549,7 @@ mod tests { #[test] fn ensure_trailing_newline_does_nothing_when_already_present() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor\n"); @@ -1565,7 +1565,7 @@ mod tests { #[test] fn paste_with_inline_content_replaces_selection() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp"); app.clipboard.set_content(ClipboardContent::Inline("editor".to_string())).unwrap(); @@ -1587,7 +1587,7 @@ mod tests { #[test] fn paste_with_block_content_replaces_selection() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor"); app.clipboard.set_content(ClipboardContent::Block("paste amp\n".to_string())).unwrap(); @@ -1609,7 +1609,7 @@ mod tests { #[test] fn paste_above_inserts_clipboard_contents_on_a_new_line_above() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); let original_position = Position { line: 0, @@ -1632,7 +1632,7 @@ mod tests { #[test] fn close_displays_confirmation_when_buffer_is_modified() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("data"); @@ -1649,7 +1649,7 @@ mod tests { #[test] fn close_skips_confirmation_when_buffer_is_empty() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let buffer = Buffer::new(); // Empty the workspace. @@ -1665,7 +1665,7 @@ mod tests { #[test] fn close_skips_confirmation_when_buffer_is_unmodified() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let buffer = Buffer::from_file(Path::new("LICENSE")).unwrap(); // Empty the workspace. @@ -1681,7 +1681,7 @@ mod tests { #[test] fn close_others_skips_confirmation_when_all_other_buffers_are_empty_or_unmodified() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let buffer_1 = Buffer::new(); let buffer_2 = Buffer::from_file(Path::new("LICENSE")).unwrap(); let mut buffer_3 = Buffer::new(); @@ -1704,7 +1704,7 @@ mod tests { #[test] fn close_others_displays_confirmation_before_closing_modified_buffer() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let buffer = Buffer::new(); let mut modified_buffer = Buffer::new(); modified_buffer.insert("data"); @@ -1733,7 +1733,7 @@ mod tests { #[test] fn close_others_works_when_current_buffer_is_last() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer_1 = Buffer::new(); let mut buffer_2 = Buffer::new(); let mut buffer_3 = Buffer::new(); @@ -1757,7 +1757,7 @@ mod tests { #[test] fn close_others_works_when_current_buffer_is_not_last() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer_1 = Buffer::new(); let mut buffer_2 = Buffer::new(); let mut buffer_3 = Buffer::new(); @@ -1780,7 +1780,7 @@ mod tests { #[test] fn toggle_line_comment_add_single_in_normal_mode() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("\tamp\n\teditor\n"); buffer.cursor.move_to(Position { @@ -1802,7 +1802,7 @@ mod tests { #[test] fn toggle_line_comment_add_multiple_in_select_line_mode() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("\tamp\n\t\teditor\n"); buffer.cursor.move_to(Position { @@ -1830,7 +1830,7 @@ mod tests { #[test] fn toggle_line_comment_remove_single_in_normal_mode() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("\t// amp\n\teditor\n"); buffer.cursor.move_to(Position { @@ -1852,7 +1852,7 @@ mod tests { #[test] fn toggle_line_comment_remove_multiple_in_select_line_mode() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("\t// amp\n\t// \teditor\n"); buffer.cursor.move_to(Position { @@ -1880,7 +1880,7 @@ mod tests { #[test] fn toggle_line_comment_remove_multiple_with_unequal_indent_in_select_line_mode() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("\t// amp\n\t\t// editor\n"); buffer.cursor.move_to(Position { @@ -1908,7 +1908,7 @@ mod tests { #[test] fn toggle_line_comment_add_correctly_preserves_empty_lines() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("\tamp\n\n\teditor\n"); buffer.cursor.move_to(Position { @@ -1936,7 +1936,7 @@ mod tests { #[test] fn toggle_line_comment_remove_correctly_preserves_empty_lines() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("\t// amp\n\n\t// editor\n"); buffer.cursor.move_to(Position { diff --git a/src/commands/cursor.rs b/src/commands/cursor.rs index 8d05e3ef..1d90658b 100644 --- a/src/commands/cursor.rs +++ b/src/commands/cursor.rs @@ -374,7 +374,7 @@ mod tests { } fn set_up_application(content: &str) -> Application { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); // Insert data with indentation and move to the end of the line. diff --git a/src/commands/line_jump.rs b/src/commands/line_jump.rs index 59b733f8..c8d25fcb 100644 --- a/src/commands/line_jump.rs +++ b/src/commands/line_jump.rs @@ -86,7 +86,7 @@ mod tests { #[test] fn accept_input_moves_cursor_to_requested_line_and_changes_modes() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor\neditor"); @@ -118,7 +118,7 @@ mod tests { #[test] fn accept_input_handles_unavailable_offsets() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor\namp"); buffer.cursor.move_to(Position { @@ -154,7 +154,7 @@ mod tests { #[test] fn accept_input_ignores_zero_input() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp\neditor\namp"); diff --git a/src/commands/path.rs b/src/commands/path.rs index 9683e6dc..84f8609e 100644 --- a/src/commands/path.rs +++ b/src/commands/path.rs @@ -63,7 +63,7 @@ mod tests { #[test] fn accept_path_sets_buffer_path_based_on_input_and_switches_to_normal_mode() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let buffer = Buffer::new(); app.workspace.add_buffer(buffer); @@ -88,7 +88,7 @@ mod tests { #[test] fn accept_path_respects_save_on_accept_flag() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let buffer = Buffer::new(); app.workspace.add_buffer(buffer); @@ -106,7 +106,7 @@ mod tests { #[test] fn accept_path_doesnt_set_buffer_path_for_empty_input_and_doesnt_change_modes() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let buffer = Buffer::new(); app.workspace.add_buffer(buffer); @@ -129,7 +129,7 @@ mod tests { #[test] fn accept_path_updates_syntax() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let buffer = Buffer::new(); app.workspace.add_buffer(buffer); diff --git a/src/commands/search.rs b/src/commands/search.rs index 70cd9fd7..3e4902c3 100644 --- a/src/commands/search.rs +++ b/src/commands/search.rs @@ -143,7 +143,7 @@ mod tests { #[test] fn move_to_previous_result_moves_cursor_to_previous_result() { // Build a workspace with a buffer and text. - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp editor\nedit\nedit"); @@ -173,7 +173,7 @@ mod tests { #[test] fn move_to_previous_result_wraps_to_the_end_of_the_document() { // Build a workspace with a buffer and text. - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp editor\nedit\nedit"); app.workspace.add_buffer(buffer); @@ -199,7 +199,7 @@ mod tests { #[test] fn move_to_next_result_moves_cursor_to_next_result() { // Build a workspace with a buffer and text. - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp editor\nedit\nedit"); app.workspace.add_buffer(buffer); @@ -225,7 +225,7 @@ mod tests { #[test] fn move_to_next_result_wraps_to_the_start_of_the_document() { // Build a workspace with a buffer and text. - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp editor\nedit\nedit"); @@ -255,7 +255,7 @@ mod tests { #[test] fn accept_query_disables_insert_sub_mode_and_moves_to_next_match() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); buffer.insert("amp editor\nedit\nedit"); diff --git a/src/commands/selection.rs b/src/commands/selection.rs index 09033221..a872397d 100644 --- a/src/commands/selection.rs +++ b/src/commands/selection.rs @@ -84,7 +84,7 @@ pub fn justify(app: &mut Application) -> Result { let range = sel_to_range(app)?; let mut buffer = app.workspace.current_buffer().unwrap(); - let limit = match app.preferences.borrow().line_length_guide() { + let limit = match app.preferences.borrow().line_length_guide(buffer.path.as_ref()) { Some(n) => n, None => bail!("Justification requires a line_length_guide."), }; @@ -135,7 +135,7 @@ mod tests { #[test] fn select_all_selects_the_entire_buffer() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); // Insert data with indentation and move to the end of the line. @@ -167,7 +167,7 @@ mod tests { #[test] fn delete_removes_the_selection_in_select_mode() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); // Insert data with indentation and move to the end of the line. @@ -194,7 +194,7 @@ mod tests { #[test] fn delete_removes_the_selected_line_in_select_line_mode() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); // Insert data with indentation and move to the end of the line. @@ -220,7 +220,7 @@ mod tests { #[test] fn delete_removes_the_current_result_in_search_mode() { - let mut app = Application::new(&Vec::new()).unwrap(); + let mut app = Application::new(&Vec::new(), Vec::new()).unwrap(); let mut buffer = Buffer::new(); // Insert data with indentation and move to the end of the line. diff --git a/src/input/key_map/mod.rs b/src/input/key_map/mod.rs index ba30309b..dece5629 100644 --- a/src/input/key_map/mod.rs +++ b/src/input/key_map/mod.rs @@ -40,9 +40,9 @@ impl KeyMap { } /// Searches the keymap for the specified key. + /// /// Character keys will fall back to wildcard character bindings /// if the specific character binding cannot be found. - /// pub fn commands_for(&self, mode: &str, key: &Key) -> Option> { self.0.get(mode).and_then(|mode_keymap| { if let Key::Char(_) = *key { @@ -77,6 +77,7 @@ impl KeyMap { /// /// e.g. /// + /// ```yml /// normal: /// k: "cursor::move_up" /// @@ -86,13 +87,16 @@ impl KeyMap { /// j: "cursor::move_down" /// unknown: /// l: "cursor::move_right" + /// ``` /// /// becomes this: /// - /// "normal" => { - /// Key::Char('k') => commands::cursor::move_up - /// Key::Char('j') => commands::cursor::move_down - /// } + /// ```ignore + /// "normal" => { + /// Key::Char('k') => commands::cursor::move_up + /// Key::Char('j') => commands::cursor::move_down + /// } + /// ``` /// pub fn merge(&mut self, mut key_map: KeyMap) { // Step through the specified key map's modes. diff --git a/src/main.rs b/src/main.rs index 018a97f6..2bfaa32a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,11 +3,58 @@ use amp::Application; use amp::Error; use std::env; +static USAGE: &'static str = "\ +Usage: + amp --help Show this help message. + amp [opts] Launch Amp in the given directory. + amp [opts] Launch Amp to edit the given file. + +[opts] are a (potentially empty) set of options that override config values, +for instance `amp --line_length_guide 72 `. These take precedence over +all values in the config file."; + +enum Action { + Help, + Run { + paths: Vec, + options: Vec<(String, String)>, + }, +} + fn main() { - // Instantiate, run, and handle errors for the application. - if let Some(e) = Application::new(&env::args().collect()) - .and_then(|mut app| app.run()) - .err() { handle_error(&e) } + let action = parse_args(env::args().skip(1)); + + match action { + Action::Help => println!("{}", USAGE), + Action::Run { paths, options } => + if let Err(e) = Application::new( + &paths, options + ).and_then(|mut app| app.run()) { + handle_error(&e) + }, + } +} + +fn parse_args(args: impl Iterator) -> Action { + let mut paths = Vec::new(); + let mut options = Vec::new(); + let mut curr_option = None; + + for (i, arg) in args.enumerate() { + if i == 0 && arg == "--help" { + return Action::Help; + } + + if let Some(opt_k) = curr_option.take() { + options.push((opt_k, arg)); + } else if arg.starts_with("--") { + curr_option = Some(arg[2..].to_string()); + } else { + paths.push(arg); + } + } + + Action::Run { paths, options } } fn handle_error(error: &Error) { diff --git a/src/models/application/mod.rs b/src/models/application/mod.rs index 2e18b96c..3bd074b4 100644 --- a/src/models/application/mod.rs +++ b/src/models/application/mod.rs @@ -54,8 +54,8 @@ pub struct Application { } impl Application { - pub fn new(args: &Vec) -> Result { - let preferences = initialize_preferences(); + pub fn new(args: &Vec, opts: Vec<(String, String)>) -> Result { + let preferences = initialize_preferences(opts); let (event_channel, events) = mpsc::channel(); let mut view = View::new(preferences.clone(), event_channel.clone())?; @@ -218,15 +218,16 @@ impl Application { } } -fn initialize_preferences() -> Rc> { +fn initialize_preferences(overrides: Vec<(String, String)>) -> Rc> { Rc::new(RefCell::new( - Preferences::load().unwrap_or_else(|_| Preferences::new(None)), + Preferences::load(overrides) + .unwrap_or_else(|_| Preferences::new(None)), )) } fn create_workspace(view: &mut View, preferences: &Preferences, args: &Vec) -> Result { // Discard the executable portion of the argument list. - let mut path_args = args.iter().skip(1).peekable(); + let mut path_args = args.iter().peekable(); // Move into an argument-specified directory, if present. let initial_dir = env::current_dir()?; @@ -314,7 +315,7 @@ mod tests { #[test] fn application_uses_file_arguments_to_load_contents_into_buffers_when_files_exist() { let mut application = - Application::new(&vec![String::new(), String::from("Cargo.lock")]).unwrap(); + Application::new(&vec![String::from("Cargo.lock")], Vec::new()).unwrap(); let buffer = Buffer::from_file(Path::new("Cargo.lock")).unwrap(); assert_eq!( @@ -330,7 +331,7 @@ mod tests { #[test] fn application_uses_file_arguments_to_create_new_buffers_when_files_do_not_exist() { let mut application = - Application::new(&vec![String::new(), String::from("non_existent_file")]).unwrap(); + Application::new(&vec![String::from("non_existent_file")], Vec::new()).unwrap(); assert_eq!( application.workspace.current_buffer().unwrap().path, diff --git a/src/models/application/preferences/mod.rs b/src/models/application/preferences/mod.rs index 1dc9037e..a663ae46 100644 --- a/src/models/application/preferences/mod.rs +++ b/src/models/application/preferences/mod.rs @@ -9,11 +9,15 @@ use std::io::Read; use std::path::{Path, PathBuf}; use crate::yaml::yaml::{Hash, Yaml, YamlLoader}; use crate::models::application::modes::SearchSelectConfig; +use linked_hash_map::LinkedHashMap; + +use lazy_static; const APP_INFO: AppInfo = AppInfo { name: "amp", author: "Jordan MacDonald", }; + const FILE_NAME: &str = "config.yml"; const LINE_COMMENT_PREFIX_KEY: &str = "line_comment_prefix"; const LINE_LENGTH_GUIDE_KEY: &str = "line_length_guide"; @@ -29,50 +33,53 @@ const THEME_PATH: &str = "themes"; const TYPES_KEY: &str = "types"; const TYPES_SYNTAX_KEY: &str = "syntax"; +lazy_static! { + static ref DEFAULT_PREFERENCES: Yaml = { + YamlLoader::load_from_str(include_str!("default.yml")) + .expect("Unparseable default preferences file!") + .into_iter() + .next() + .expect("Invalid default preferences file!") + }; +} + /// Loads, creates, and provides default values for application preferences. /// Values are immutable once loaded, with the exception of those that provide /// expicit setter methods (e.g. `theme`). pub struct Preferences { - default: Yaml, - data: Option, + data: Yaml, keymap: KeyMap, - theme: Option, + + // Store in-memory overrides for settings. This shouldn't be more than a + // few values (i.e., what the user can specify on the command line). + overrides: Vec<(String, String)> } impl Preferences { /// Builds a new in-memory instance with default values. pub fn new(data: Option) -> Preferences { Preferences { - default: load_default_document().expect("Failed to load default preferences!"), - data, + data: data.unwrap_or(Yaml::Hash(LinkedHashMap::new())), keymap: KeyMap::default().expect("Failed to load default keymap!"), - theme: None + overrides: Vec::new(), } } /// Loads preferences from disk, returning any filesystem or parse errors. - pub fn load() -> Result { - let default = load_default_document()?; + pub fn load(overrides: Vec<(String, String)>) -> Result { let data = load_document()?; - let keymap = load_keymap( - data.as_ref().and_then(|data| data["keymap"].as_hash()) - )?; + let keymap = load_keymap(data["keymap"].as_hash())?; - Ok(Preferences { default, data, keymap, theme: None }) + Ok(Preferences { data, keymap, overrides, }) } /// Reloads all user preferences from disk and merges them with defaults. pub fn reload(&mut self) -> Result<()> { - let default = load_default_document()?; let data = load_document()?; - let keymap = load_keymap( - data.as_ref().and_then(|data| data["keymap"].as_hash()) - )?; + let keymap = load_keymap(data["keymap"].as_hash())?; - self.default = default; self.data = data; self.keymap = keymap; - self.theme = None; Ok(()) } @@ -116,20 +123,9 @@ impl Preferences { /// If set, returns the in-memory theme, falling back to the value set via /// the configuration file, and then the default value. - pub fn theme(&self) -> &str { - // Return the mutable in-memory value, if set. - if let Some(ref theme) = self.theme { return theme; } - - self.data - .as_ref() - .and_then(|data| if let Yaml::String(ref theme) = data[THEME_KEY] { - Some(theme.as_str()) - } else { - None - }) - .unwrap_or_else(|| { - self.default[THEME_KEY].as_str().expect("Couldn't find default theme name!") - }) + pub fn theme(&self) -> String { + self.value(THEME_KEY, None, None) + .as_str().expect("No valid theme was found!").to_string() } /// Returns the theme path, making sure the directory exists. @@ -140,95 +136,60 @@ impl Preferences { /// Updates the in-memory theme value. pub fn set_theme>(&mut self, theme: T) { - self.theme = Some(theme.into()); + self.data.as_hash_mut().expect("Settings are invalid") + .insert(Yaml::String(THEME_KEY.to_string()), Yaml::String(theme.into())); } pub fn tab_width(&self, path: Option<&PathBuf>) -> usize { - self.data - .as_ref() - .and_then(|data| { - if let Some(extension) = path_extension(path) { - if let Yaml::Integer(tab_width) = data[TYPES_KEY][extension][TAB_WIDTH_KEY] { - return Some(tab_width as usize); - } else if let Yaml::Integer(tab_width) = data[TAB_WIDTH_KEY] { - return Some(tab_width as usize); - } - } else if let Yaml::Integer(tab_width) = data[TAB_WIDTH_KEY] { - return Some(tab_width as usize); - } - - None - }) - .unwrap_or_else(|| { - self.default[TAB_WIDTH_KEY].as_i64() - .expect("Couldn't find default tab width setting!") as usize - }) + match self.value( + TAB_WIDTH_KEY, path_extension(path), path.and_then(|x| x.to_str()) + ) { + Yaml::String(s) => s.parse().expect("No valid tab width was found!"), + Yaml::Integer(i) => i as usize, + _ => panic!("No valid tab width was found!"), + } } + pub fn search_select_config(&self) -> SearchSelectConfig { let mut result = SearchSelectConfig::default(); - if let Some(ref data) = self.data { - if let Yaml::Integer(max_results) = data[SEARCH_SELECT_KEY]["max_results"] { - result.max_results = max_results as usize; - } + if let Yaml::Integer(max_results) = self.data[SEARCH_SELECT_KEY]["max_results"] { + result.max_results = max_results as usize; } result } pub fn soft_tabs(&self, path: Option<&PathBuf>) -> bool { - self.data - .as_ref() - .and_then(|data| { - if let Some(extension) = path_extension(path) { - if let Yaml::Boolean(soft_tabs) = data[TYPES_KEY][extension][SOFT_TABS_KEY] { - return Some(soft_tabs); - } else if let Yaml::Boolean(soft_tabs) = data[SOFT_TABS_KEY] { - return Some(soft_tabs); - } - } else if let Yaml::Boolean(soft_tabs) = data[SOFT_TABS_KEY] { - return Some(soft_tabs); - } - - None - }) - .unwrap_or_else(|| { - self.default[SOFT_TABS_KEY].as_bool() - .expect("Couldn't find default soft tabs setting!") - }) - } - - pub fn line_length_guide(&self) -> Option { - self.data - .as_ref() - .and_then(|data| match data[LINE_LENGTH_GUIDE_KEY] { - Yaml::Integer(line_length) => Some(line_length as usize), - Yaml::Boolean(line_length_guide) => { - let default = self.default[LINE_LENGTH_GUIDE_KEY].as_i64() - .expect("Couldn't find default line length guide setting!"); - - if line_length_guide { - Some(default as usize) - } else { - None - } - } - _ => None, - }) + match self.value( + SOFT_TABS_KEY, path_extension(path), path.and_then(|x| x.to_str()) + ) { + Yaml::Boolean(b) => b, + Yaml::String(s) => s == "true", + _ => panic!("No valid soft tabs setting was found!"), + } + } + pub fn line_length_guide<'a, 'b>( + &'a self, path: Option<&'b PathBuf> + ) -> Option { + match self.value( + LINE_LENGTH_GUIDE_KEY, + path_extension(path), + path.and_then(|x| x.to_str()), + ) { + Yaml::Integer(ref x) => Some(*x as usize), + Yaml::String(ref x) => x.parse().ok(), + Yaml::Boolean(ref x) if *x => match DEFAULT_PREFERENCES[LINE_LENGTH_GUIDE_KEY] { + Yaml::Integer(ref x) => Some(*x as usize), + _ => panic!("No default line length guide specified."), + } + _ => None, + } } pub fn line_wrapping(&self) -> bool { - self.data - .as_ref() - .and_then(|data| if let Yaml::Boolean(wrapping) = data[LINE_WRAPPING_KEY] { - Some(wrapping) - } else { - None - }) - .unwrap_or_else(|| { - self.default[LINE_WRAPPING_KEY].as_bool() - .expect("Couldn't find default line wrapping setting!") - }) + self.value(LINE_WRAPPING_KEY, None, None) + .as_bool().expect("No valid line wrapping setting was found.") } pub fn tab_content(&self, path: Option<&PathBuf>) -> String { @@ -240,59 +201,56 @@ impl Preferences { } pub fn open_mode_exclusions(&self) -> Result>> { - let exclusion_data = self.data - .as_ref() - .map(|data| &data[OPEN_MODE_KEY][OPEN_MODE_EXCLUSIONS_KEY]); - - if let Some(exclusion_data) = exclusion_data { - match *exclusion_data { - Yaml::Array(ref exclusions) => { - open::exclusions::parse(exclusions) - .chain_err(|| "Failed to parse user-defined open mode exclusions") - .map(Some) - }, - Yaml::Boolean(_) => Ok(None), - _ => self.default_open_mode_exclusions(), - } - } else { - self.default_open_mode_exclusions() + let exclusion_data = &self.data[OPEN_MODE_KEY][OPEN_MODE_EXCLUSIONS_KEY]; + + match *exclusion_data { + Yaml::Array(ref exclusions) => { + open::exclusions::parse(exclusions) + .chain_err(|| "Failed to parse user-defined open mode exclusions") + .map(Some) + }, + Yaml::Boolean(_) => Ok(None), + _ => self.default_open_mode_exclusions(), } } pub fn line_comment_prefix(&self, path: &PathBuf) -> Option { - let extension = path_extension(Some(path))?; - - self.data - .as_ref() - .and_then(|data| data[TYPES_KEY][extension][LINE_COMMENT_PREFIX_KEY].as_str()) - .or_else(|| self.default[TYPES_KEY][extension][LINE_COMMENT_PREFIX_KEY].as_str()) - .map(|prefix| prefix.to_owned()) + self.value( + LINE_COMMENT_PREFIX_KEY, + path.extension().and_then(|x| x.to_str()), + path.file_name().and_then(|x| x.to_str()), + ).as_str().and_then(|x| Some(x.to_owned())) } pub fn syntax_definition_name(&self, path: &Path) -> Option { - self.data - .as_ref() - .and_then(|data| { - // First try to match the file extension - if let Some(extension) = path.extension().and_then(|ext| ext.to_str()) { - if let Some(syntax) = data[TYPES_KEY][extension][TYPES_SYNTAX_KEY].as_str() { - return Some(syntax.to_owned()); - } - } - - // If matching the file extension fails, try matching the whole filename - if let Some(path) = path.file_name().and_then(|name| name.to_str()) { - if let Some(syntax) = data[TYPES_KEY][path][TYPES_SYNTAX_KEY].as_str() { - return Some(syntax.to_owned()); - } - } - - None - }) + self.value( + TYPES_SYNTAX_KEY, + path.extension().and_then(|x| x.to_str()), + path.file_name().and_then(|x| x.to_str()) + ).as_str().and_then(|x| Some(x.to_owned())) + } + + /// Locate the value for a given key. Searches, in this order: + /// 1. File name specific settings (skipped if given as None) + /// 2. File extension specific settings (skipped if given as None) + /// 3. Global options. + /// 4. DEFAULT_PREFERENCES + fn value<'a, 'b>( + &'a self, key: &'b str, ext: Option<&'b str>, name: Option<&'b str> + ) -> Yaml { + for (ok, ov) in &self.overrides { + if ok == key { + return Yaml::String(ov.to_string()); + } + } + + find_with_precedence(&self.data, key, ext, name) + .borrowed_or(find_with_precedence(&DEFAULT_PREFERENCES, key, ext, name)) + .clone() } fn default_open_mode_exclusions(&self) -> Result>> { - let exclusions = self.default[OPEN_MODE_KEY][OPEN_MODE_EXCLUSIONS_KEY] + let exclusions = DEFAULT_PREFERENCES[OPEN_MODE_KEY][OPEN_MODE_EXCLUSIONS_KEY] .as_vec() .chain_err(|| "Couldn't find default open mode exclusions settings!")?; @@ -302,8 +260,23 @@ impl Preferences { } } -/// Loads the first YAML document in the user's config file. -fn load_document() -> Result> { +fn find_with_precedence<'a, 'b>( + doc: &'a Yaml, key: &'b str, ext: Option<&'b str>, name: Option<&'b str> +) -> &'a Yaml { + let name_match = if let Some(name) = name { + &doc[TYPES_KEY][name][key] + } else { &Yaml::Null }; + let ext_match = if let Some(ext) = ext { + &doc[TYPES_KEY][ext][key] + } else { &Yaml::Null }; + let general_match = &doc[key]; + + name_match.borrowed_or(ext_match).borrowed_or(general_match) +} + +/// Loads the first YAML document in the user's config file. Will return +/// `Yaml::Null` if none exists. +fn load_document() -> Result { // Build a path to the config file. let mut config_path = get_app_root(AppDataType::UserConfig, &APP_INFO) @@ -325,14 +298,7 @@ fn load_document() -> Result> { // Parse the config file's contents and get the first YAML document inside. let parsed_data = YamlLoader::load_from_str(&data) .chain_err(|| "Couldn't parse config file")?; - Ok(parsed_data.into_iter().nth(0)) -} - -fn load_default_document() -> Result { - YamlLoader::load_from_str(include_str!("default.yml")) - .chain_err(|| "Couldn't parse default config file")? - .into_iter().nth(0) - .chain_err(|| "No default preferences document found") + Ok(parsed_data.into_iter().next().unwrap_or(Yaml::Null)) } /// Loads default keymaps, merging in the provided overrides. @@ -356,10 +322,10 @@ fn path_extension(path: Option<&PathBuf>) -> Option<&str> { #[cfg(test)] mod tests { - use super::{ExclusionPattern, Preferences, YamlLoader}; + use super::{ExclusionPattern, Preferences, YamlLoader, Yaml}; use std::path::{Path, PathBuf}; use crate::input::KeyMap; - use crate::yaml::yaml::{Hash, Yaml}; + use crate::yaml::yaml::{Hash}; #[test] fn preferences_returns_user_defined_theme_name() { @@ -507,7 +473,7 @@ mod tests { let data = YamlLoader::load_from_str("line_length_guide: 100").unwrap(); let preferences = Preferences::new(data.into_iter().nth(0)); - assert_eq!(preferences.line_length_guide(), Some(100)); + assert_eq!(preferences.line_length_guide(None), Some(100)); } #[test] @@ -515,7 +481,7 @@ mod tests { let data = YamlLoader::load_from_str("line_length_guide: false").unwrap(); let preferences = Preferences::new(data.into_iter().nth(0)); - assert_eq!(preferences.line_length_guide(), None); + assert_eq!(preferences.line_length_guide(None), None); } #[test] @@ -523,7 +489,7 @@ mod tests { let data = YamlLoader::load_from_str("line_length_guide: true").unwrap(); let preferences = Preferences::new(data.into_iter().nth(0)); - assert_eq!(preferences.line_length_guide(), Some(80)); + assert_eq!(preferences.line_length_guide(None), Some(80)); } #[test] @@ -645,7 +611,7 @@ mod tests { #[test] fn reload_clears_in_memory_theme() { // Create an on-disk preferences file first, if one doesn't already exist. - if Preferences::load().is_err() { + if Preferences::load(Vec::new()).is_err() { Preferences::edit().unwrap().save().unwrap(); } @@ -661,16 +627,15 @@ mod tests { #[test] fn reload_refreshes_in_memory_keymap() { // Create an on-disk preferences file first, if one doesn't already exist. - if Preferences::load().is_err() { + if Preferences::load(Vec::new()).is_err() { Preferences::edit().unwrap().save().unwrap(); } // Build a preferences instance with an empty keymap. let mut preferences = Preferences { - default: Yaml::Null, - data: None, + data: Yaml::Null, keymap: KeyMap::from(&Hash::new()).unwrap(), - theme: None + overrides: Vec::new(), }; // Reload the preferences, ensuring that it refreshes the keymap. diff --git a/src/view/buffer/renderer.rs b/src/view/buffer/renderer.rs index 3dcb4257..d137965f 100644 --- a/src/view/buffer/renderer.rs +++ b/src/view/buffer/renderer.rs @@ -93,7 +93,9 @@ impl<'a, 'p> BufferRenderer<'a, 'p> { } fn length_guide_offset(&self) -> Option { - self.preferences.line_length_guide().map(|offset| self.gutter_width + offset) + self.preferences + .line_length_guide(self.buffer.path.as_ref()) + .map(|offset| self.gutter_width + offset) } fn advance_to_next_line(&mut self) { diff --git a/src/view/presenter.rs b/src/view/presenter.rs index 8a726b86..0188ec78 100644 --- a/src/view/presenter.rs +++ b/src/view/presenter.rs @@ -23,7 +23,7 @@ impl<'p> Presenter<'p> { let preferences = view.preferences.borrow(); let theme_name = preferences.theme(); let theme = view.theme_set.themes - .get(theme_name) + .get(&theme_name) .ok_or_else(|| format!("Couldn't find \"{}\" theme", theme_name))?; theme.clone() };