mirror of
https://github.com/watchexec/watchexec.git
synced 2024-11-13 07:41:11 +01:00
Move config creation out of arg parsing, and start on using libv2
This commit is contained in:
parent
23d794ed7e
commit
e939f97c90
5 changed files with 152 additions and 469 deletions
297
Cargo.lock
generated
297
Cargo.lock
generated
|
@ -17,22 +17,13 @@ version = "1.0.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
|
||||
dependencies = [
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -77,7 +68,7 @@ dependencies = [
|
|||
"slab",
|
||||
"socket2",
|
||||
"waker-fn",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -116,7 +107,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
|||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -232,7 +223,7 @@ dependencies = [
|
|||
"num-integer",
|
||||
"num-traits",
|
||||
"time",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -266,7 +257,7 @@ dependencies = [
|
|||
"terminfo",
|
||||
"thiserror",
|
||||
"which",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -305,7 +296,7 @@ dependencies = [
|
|||
"async-trait",
|
||||
"nix 0.22.0",
|
||||
"tokio",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -327,7 +318,7 @@ dependencies = [
|
|||
"lazy_static",
|
||||
"libc",
|
||||
"terminal_size",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -447,7 +438,7 @@ checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901"
|
|||
dependencies = [
|
||||
"libc",
|
||||
"redox_users 0.3.5",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -468,7 +459,7 @@ checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780"
|
|||
dependencies = [
|
||||
"libc",
|
||||
"redox_users 0.4.0",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -533,15 +524,6 @@ dependencies = [
|
|||
"syn 1.0.73",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
|
||||
dependencies = [
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "envmnt"
|
||||
version = "0.9.0"
|
||||
|
@ -580,7 +562,7 @@ dependencies = [
|
|||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
"redox_syscall 0.2.9",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -589,25 +571,6 @@ version = "1.0.7"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "fsevent"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1",
|
||||
"fsevent-sys 2.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fsevent-sys"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fsevent-sys"
|
||||
version = "4.0.0"
|
||||
|
@ -623,22 +586,6 @@ version = "0.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a50045aa8931ae01afbc5d72439e8f57f326becb8c70d07dfc816778eff3d167"
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-zircon"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1",
|
||||
"fuchsia-zircon-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-zircon-sys"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
|
||||
|
||||
[[package]]
|
||||
name = "futures"
|
||||
version = "0.3.16"
|
||||
|
@ -776,25 +723,6 @@ version = "0.24.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e4075386626662786ddb0ec9081e7c7eeb1ba31951f447ca780ef9f5d568189"
|
||||
|
||||
[[package]]
|
||||
name = "glob"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
||||
|
||||
[[package]]
|
||||
name = "globset"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c152169ef1e421390738366d2f796655fec62621dabbd0fd476f905934061e4a"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"bstr",
|
||||
"fnv",
|
||||
"log",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.11.2"
|
||||
|
@ -832,17 +760,6 @@ dependencies = [
|
|||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inotify"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1",
|
||||
"inotify-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inotify"
|
||||
version = "0.9.3"
|
||||
|
@ -887,15 +804,6 @@ dependencies = [
|
|||
"cfg-if 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iovec"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.10.1"
|
||||
|
@ -911,16 +819,6 @@ version = "0.4.7"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
|
||||
|
||||
[[package]]
|
||||
name = "kernel32-sys"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
dependencies = [
|
||||
"winapi 0.2.8",
|
||||
"winapi-build",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kqueue"
|
||||
version = "1.0.4"
|
||||
|
@ -947,12 +845,6 @@ version = "1.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "lazycell"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.98"
|
||||
|
@ -1063,25 +955,6 @@ dependencies = [
|
|||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.6.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"fuchsia-zircon",
|
||||
"fuchsia-zircon-sys",
|
||||
"iovec",
|
||||
"kernel32-sys",
|
||||
"libc",
|
||||
"log",
|
||||
"miow 0.2.2",
|
||||
"net2",
|
||||
"slab",
|
||||
"winapi 0.2.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.7.13"
|
||||
|
@ -1090,33 +963,9 @@ checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16"
|
|||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"miow 0.3.7",
|
||||
"miow",
|
||||
"ntapi",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio-extras"
|
||||
version = "2.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19"
|
||||
dependencies = [
|
||||
"lazycell",
|
||||
"log",
|
||||
"mio 0.6.23",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miow"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d"
|
||||
dependencies = [
|
||||
"kernel32-sys",
|
||||
"net2",
|
||||
"winapi 0.2.8",
|
||||
"ws2_32-sys",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1125,7 +974,7 @@ version = "0.3.7"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
|
||||
dependencies = [
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1138,17 +987,6 @@ dependencies = [
|
|||
"socket2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "net2"
|
||||
version = "0.2.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"libc",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.17.0"
|
||||
|
@ -1185,24 +1023,6 @@ dependencies = [
|
|||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "notify"
|
||||
version = "4.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae03c8c853dba7bfd23e571ff0cff7bc9dceb40a4cd684cd1681824183f45257"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1",
|
||||
"filetime",
|
||||
"fsevent",
|
||||
"fsevent-sys 2.0.1",
|
||||
"inotify 0.7.1",
|
||||
"libc",
|
||||
"mio 0.6.23",
|
||||
"mio-extras",
|
||||
"walkdir",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "notify"
|
||||
version = "5.0.0-pre.12"
|
||||
|
@ -1212,13 +1032,13 @@ dependencies = [
|
|||
"bitflags 1.2.1",
|
||||
"crossbeam-channel",
|
||||
"filetime",
|
||||
"fsevent-sys 4.0.0",
|
||||
"inotify 0.9.3",
|
||||
"fsevent-sys",
|
||||
"inotify",
|
||||
"kqueue",
|
||||
"libc",
|
||||
"mio 0.7.13",
|
||||
"mio",
|
||||
"walkdir",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1241,7 +1061,7 @@ version = "0.3.6"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44"
|
||||
dependencies = [
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1357,7 +1177,7 @@ dependencies = [
|
|||
"libc",
|
||||
"redox_syscall 0.2.9",
|
||||
"smallvec",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1420,7 +1240,7 @@ dependencies = [
|
|||
"libc",
|
||||
"log",
|
||||
"wepoll-ffi",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1604,8 +1424,6 @@ version = "1.5.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
|
@ -1772,7 +1590,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "765f090f0e423d2b55843402a07915add955e7d60657db13707a159727326cad"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1841,7 +1659,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1851,7 +1669,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1913,7 +1731,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1926,14 +1744,14 @@ dependencies = [
|
|||
"bytes",
|
||||
"libc",
|
||||
"memchr",
|
||||
"mio 0.7.13",
|
||||
"mio",
|
||||
"num_cpus",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"tokio-macros",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2021,9 +1839,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tracing-subscriber"
|
||||
version = "0.2.19"
|
||||
version = "0.2.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab69019741fca4d98be3c62d2b75254528b5432233fd8a4d2739fec20278de48"
|
||||
checksum = "b9cbe87a2fa7e35900ce5de20220a582a9483a7063811defce79d7cbd59d4cfe"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"chrono",
|
||||
|
@ -2125,7 +1943,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
|
@ -2154,7 +1972,7 @@ dependencies = [
|
|||
"dunce",
|
||||
"futures",
|
||||
"miette",
|
||||
"notify 5.0.0-pre.12",
|
||||
"notify",
|
||||
"once_cell",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
|
@ -2162,25 +1980,6 @@ dependencies = [
|
|||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "watchexec"
|
||||
version = "1.17.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c52e0868bc57765fa91593a173323f464855e53b27f779e1110ba0fb4cb6b406"
|
||||
dependencies = [
|
||||
"clearscreen",
|
||||
"command-group",
|
||||
"derive_builder",
|
||||
"glob",
|
||||
"globset",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"nix 0.22.0",
|
||||
"notify 4.0.17",
|
||||
"walkdir",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "watchexec-cli"
|
||||
version = "1.17.1"
|
||||
|
@ -2189,11 +1988,11 @@ dependencies = [
|
|||
"clap",
|
||||
"color-eyre",
|
||||
"embed-resource",
|
||||
"env_logger",
|
||||
"insta",
|
||||
"log",
|
||||
"notify-rust",
|
||||
"watchexec 1.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio",
|
||||
"tracing-subscriber",
|
||||
"watchexec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2216,12 +2015,6 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
|
@ -2232,12 +2025,6 @@ dependencies = [
|
|||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-build"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
|
@ -2250,7 +2037,7 @@ version = "0.1.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
|
||||
dependencies = [
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2265,7 +2052,7 @@ version = "0.9.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16cdb3898397cf7f624c294948669beafaeebc5577d5ec53d0afb76633593597"
|
||||
dependencies = [
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2274,7 +2061,7 @@ version = "0.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e30cba82e22b083dc5a422c2ee77e20dc7927271a0dc981360c57c1453cb48d"
|
||||
dependencies = [
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2285,21 +2072,11 @@ checksum = "57790eb281688a4682dab44df2a1ba8b78373233bd71cb291c3e75fecb1a01c4"
|
|||
dependencies = [
|
||||
"strum",
|
||||
"strum_macros",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
"winrt",
|
||||
"xml-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ws2_32-sys"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
|
||||
dependencies = [
|
||||
"winapi 0.2.8",
|
||||
"winapi-build",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xml-rs"
|
||||
version = "0.6.1"
|
||||
|
|
|
@ -20,20 +20,17 @@ name = "watchexec"
|
|||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
log = "0.4.14"
|
||||
watchexec = "1.17.1"
|
||||
watchexec = { path = "../lib" }
|
||||
color-eyre = "0.5.11"
|
||||
notify-rust = "4.5.2"
|
||||
tokio = { version = "1.10.0", features = ["full"] }
|
||||
tracing-subscriber = "0.2.20"
|
||||
|
||||
[dependencies.clap]
|
||||
version = "2.33.3"
|
||||
default-features = false
|
||||
features = ["wrap_help"]
|
||||
|
||||
[dependencies.env_logger]
|
||||
version = "0.9.0"
|
||||
default-features = false
|
||||
|
||||
[build-dependencies]
|
||||
embed-resource = "1.6.1"
|
||||
|
||||
|
@ -56,21 +53,21 @@ license-file = ["../LICENSE", "0"]
|
|||
section = "utility"
|
||||
# conf-files = [] # look me up when config file lands
|
||||
assets = [
|
||||
["../target/release/watchexec", "usr/bin/", "755"],
|
||||
["README.md", "usr/share/doc/watchexec/README", "644"],
|
||||
["../doc/watchexec.1.html", "usr/share/doc/watchexec/watchexec.1.html", "644"],
|
||||
["../doc/watchexec.1", "usr/share/man/man1/watchexec.1.html", "644"],
|
||||
["../completions/zsh", "usr/share/zsh/site-functions/_watchexec", "644"],
|
||||
["../doc/logo.svg", "usr/share/icons/hicolor/scalable/apps/watchexec.svg", "644"],
|
||||
["../target/release/watchexec", "usr/bin/", "755"],
|
||||
["README.md", "usr/share/doc/watchexec/README", "644"],
|
||||
["../doc/watchexec.1.html", "usr/share/doc/watchexec/watchexec.1.html", "644"],
|
||||
["../doc/watchexec.1", "usr/share/man/man1/watchexec.1.html", "644"],
|
||||
["../completions/zsh", "usr/share/zsh/site-functions/_watchexec", "644"],
|
||||
["../doc/logo.svg", "usr/share/icons/hicolor/scalable/apps/watchexec.svg", "644"],
|
||||
]
|
||||
|
||||
[package.metadata.generate-rpm]
|
||||
assets = [
|
||||
{ source = "../target/release/watchexec", dest = "/usr/bin/", mode = "755" },
|
||||
{ source = "../cli/README.md", dest = "/usr/share/doc/watchexec/README", mode = "644", doc = true },
|
||||
{ source = "../doc/watchexec.1.html", dest = "/usr/share/doc/watchexec/watchexec.1.html", mode = "644", doc = true },
|
||||
{ source = "../doc/watchexec.1", dest = "/usr/share/man/man1/watchexec.1.html", mode = "644" },
|
||||
{ source = "../completions/zsh", dest = "/usr/share/zsh/site-functions/_watchexec", mode = "644" },
|
||||
{ source = "../doc/logo.svg", dest = "/usr/share/icons/hicolor/scalable/apps/watchexec.svg", mode = "644" },
|
||||
# set conf = true for config file when that lands
|
||||
{ source = "../target/release/watchexec", dest = "/usr/bin/", mode = "755" },
|
||||
{ source = "../cli/README.md", dest = "/usr/share/doc/watchexec/README", mode = "644", doc = true },
|
||||
{ source = "../doc/watchexec.1.html", dest = "/usr/share/doc/watchexec/watchexec.1.html", mode = "644", doc = true },
|
||||
{ source = "../doc/watchexec.1", dest = "/usr/share/man/man1/watchexec.1.html", mode = "644" },
|
||||
{ source = "../completions/zsh", dest = "/usr/share/zsh/site-functions/_watchexec", mode = "644" },
|
||||
{ source = "../doc/logo.svg", dest = "/usr/share/icons/hicolor/scalable/apps/watchexec.svg", mode = "644" },
|
||||
# set conf = true for config file when that lands
|
||||
]
|
||||
|
|
205
cli/src/args.rs
205
cli/src/args.rs
|
@ -1,21 +1,16 @@
|
|||
use std::{
|
||||
env,
|
||||
ffi::OsString,
|
||||
fs::File,
|
||||
io::{BufRead, BufReader},
|
||||
path::{Path, PathBuf, MAIN_SEPARATOR},
|
||||
time::Duration,
|
||||
env,
|
||||
ffi::OsString,
|
||||
fs::File,
|
||||
io::{BufRead, BufReader},
|
||||
path::Path,
|
||||
};
|
||||
|
||||
use clap::{crate_version, value_t, values_t, App, Arg};
|
||||
use clap::{crate_version, App, Arg, ArgMatches};
|
||||
use color_eyre::eyre::{Context, Report, Result};
|
||||
use log::LevelFilter;
|
||||
use watchexec::{config::ConfigBuilder, run::OnBusyUpdate, Shell};
|
||||
|
||||
use crate::handler::CliHandler;
|
||||
|
||||
pub fn get_args() -> Result<CliHandler> {
|
||||
let app = App::new("watchexec")
|
||||
pub fn get_args() -> Result<ArgMatches<'static>> {
|
||||
let app = App::new("watchexec")
|
||||
.version(crate_version!())
|
||||
.about("Execute commands when watched files change")
|
||||
.after_help("Use @argfile as first argument to load arguments from the file `argfile` (one argument per line) which will be inserted in place of the @argfile (further arguments on the CLI will override or add onto those in the file).")
|
||||
|
@ -65,6 +60,7 @@ pub fn get_args() -> Result<CliHandler> {
|
|||
.value_name("milliseconds")
|
||||
.short("d")
|
||||
.long("debounce"))
|
||||
|
||||
.arg(Arg::with_name("verbose")
|
||||
.help("Print debugging messages to stderr")
|
||||
.short("v")
|
||||
|
@ -72,6 +68,7 @@ pub fn get_args() -> Result<CliHandler> {
|
|||
.arg(Arg::with_name("changes")
|
||||
.help("Only print path change information. Overridden by --verbose")
|
||||
.long("changes-only"))
|
||||
|
||||
.arg(Arg::with_name("filter")
|
||||
.help("Ignore all modifications except those matching the pattern")
|
||||
.short("f")
|
||||
|
@ -137,173 +134,25 @@ pub fn get_args() -> Result<CliHandler> {
|
|||
.short("N")
|
||||
.long("notify"));
|
||||
|
||||
let mut raw_args: Vec<OsString> = env::args_os().collect();
|
||||
let mut raw_args: Vec<OsString> = env::args_os().collect();
|
||||
|
||||
if let Some(first) = raw_args.get(1).and_then(|s| s.to_str()) {
|
||||
if let Some(arg_path) = first.strip_prefix('@').map(Path::new) {
|
||||
let arg_file = BufReader::new(
|
||||
File::open(arg_path)
|
||||
.wrap_err_with(|| format!("Failed to open argument file {:?}", arg_path))?,
|
||||
);
|
||||
if let Some(first) = raw_args.get(1).and_then(|s| s.to_str()) {
|
||||
if let Some(arg_path) = first.strip_prefix('@').map(Path::new) {
|
||||
let arg_file = BufReader::new(
|
||||
File::open(arg_path)
|
||||
.wrap_err_with(|| format!("Failed to open argument file {:?}", arg_path))?,
|
||||
);
|
||||
|
||||
let mut more_args: Vec<OsString> = arg_file
|
||||
.lines()
|
||||
.map(|l| l.map(OsString::from).map_err(Report::from))
|
||||
.collect::<Result<_>>()?;
|
||||
let mut more_args: Vec<OsString> = arg_file
|
||||
.lines()
|
||||
.map(|l| l.map(OsString::from).map_err(Report::from))
|
||||
.collect::<Result<_>>()?;
|
||||
|
||||
more_args.insert(0, raw_args.remove(0));
|
||||
more_args.extend(raw_args.into_iter().skip(1));
|
||||
raw_args = more_args;
|
||||
}
|
||||
}
|
||||
more_args.insert(0, raw_args.remove(0));
|
||||
more_args.extend(raw_args.into_iter().skip(1));
|
||||
raw_args = more_args;
|
||||
}
|
||||
}
|
||||
|
||||
let args = app.get_matches_from(raw_args);
|
||||
let mut builder = ConfigBuilder::default();
|
||||
|
||||
let cmd: Vec<String> = values_t!(args.values_of("command"), String)?;
|
||||
builder.cmd(cmd);
|
||||
|
||||
let paths: Vec<PathBuf> = values_t!(args.values_of("path"), String)
|
||||
.unwrap_or_else(|_| vec![".".into()])
|
||||
.iter()
|
||||
.map(|string_path| string_path.into())
|
||||
.collect();
|
||||
builder.paths(paths);
|
||||
|
||||
// Treat --kill as --signal SIGKILL (for compatibility with deprecated syntax)
|
||||
if args.is_present("kill") {
|
||||
builder.signal("SIGKILL");
|
||||
}
|
||||
|
||||
if let Some(signal) = args.value_of("signal") {
|
||||
builder.signal(signal);
|
||||
}
|
||||
|
||||
let mut filters = values_t!(args.values_of("filter"), String).unwrap_or_else(|_| Vec::new());
|
||||
if let Some(extensions) = args.values_of("extensions") {
|
||||
for exts in extensions {
|
||||
// TODO: refactor with flatten()
|
||||
filters.extend(exts.split(',').filter_map(|ext| {
|
||||
if ext.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(format!("*.{}", ext.replace(".", "")))
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
builder.filters(filters);
|
||||
|
||||
let mut ignores = vec![];
|
||||
let default_ignores = vec![
|
||||
format!("**{}.DS_Store", MAIN_SEPARATOR),
|
||||
String::from("*.py[co]"),
|
||||
String::from("#*#"),
|
||||
String::from(".#*"),
|
||||
String::from(".*.kate-swp"),
|
||||
String::from(".*.sw?"),
|
||||
String::from(".*.sw?x"),
|
||||
format!("**{}.git{}**", MAIN_SEPARATOR, MAIN_SEPARATOR),
|
||||
format!("**{}.hg{}**", MAIN_SEPARATOR, MAIN_SEPARATOR),
|
||||
format!("**{}.svn{}**", MAIN_SEPARATOR, MAIN_SEPARATOR),
|
||||
];
|
||||
|
||||
if args.occurrences_of("no-default-ignore") == 0 {
|
||||
ignores.extend(default_ignores)
|
||||
};
|
||||
ignores.extend(values_t!(args.values_of("ignore"), String).unwrap_or_else(|_| Vec::new()));
|
||||
|
||||
builder.ignores(ignores);
|
||||
|
||||
if args.occurrences_of("poll") > 0 {
|
||||
builder.poll_interval(Duration::from_millis(
|
||||
value_t!(args.value_of("poll"), u64).unwrap_or_else(|e| e.exit()),
|
||||
));
|
||||
}
|
||||
|
||||
if args.occurrences_of("debounce") > 0 {
|
||||
builder.debounce(Duration::from_millis(
|
||||
value_t!(args.value_of("debounce"), u64).unwrap_or_else(|e| e.exit()),
|
||||
));
|
||||
}
|
||||
|
||||
builder.on_busy_update(if args.is_present("restart") {
|
||||
OnBusyUpdate::Restart
|
||||
} else if args.is_present("watch-when-idle") {
|
||||
OnBusyUpdate::DoNothing
|
||||
} else if let Some(s) = args.value_of("on-busy-update") {
|
||||
match s.as_bytes() {
|
||||
b"do-nothing" => OnBusyUpdate::DoNothing,
|
||||
b"queue" => OnBusyUpdate::Queue,
|
||||
b"restart" => OnBusyUpdate::Restart,
|
||||
b"signal" => OnBusyUpdate::Signal,
|
||||
_ => unreachable!("clap restricts on-busy-updates values"),
|
||||
}
|
||||
} else {
|
||||
// will become DoNothing in v2.0
|
||||
OnBusyUpdate::Queue
|
||||
});
|
||||
|
||||
builder.shell(if args.is_present("no-shell") {
|
||||
Shell::None
|
||||
} else if let Some(s) = args.value_of("shell") {
|
||||
if s.eq_ignore_ascii_case("powershell") {
|
||||
Shell::Powershell
|
||||
} else if s.eq_ignore_ascii_case("none") {
|
||||
Shell::None
|
||||
} else if s.eq_ignore_ascii_case("cmd") {
|
||||
cmd_shell(s.into())
|
||||
} else {
|
||||
Shell::Unix(s.into())
|
||||
}
|
||||
} else {
|
||||
default_shell()
|
||||
});
|
||||
|
||||
builder.clear_screen(args.is_present("clear"));
|
||||
builder.run_initially(!args.is_present("postpone"));
|
||||
builder.no_meta(args.is_present("no-meta"));
|
||||
builder.no_environment(args.is_present("no-environment"));
|
||||
builder.no_vcs_ignore(args.is_present("no-vcs-ignore"));
|
||||
builder.no_ignore(args.is_present("no-ignore"));
|
||||
builder.poll(args.occurrences_of("poll") > 0);
|
||||
builder.use_process_group(!args.is_present("no-process-group"));
|
||||
|
||||
let mut config = builder.build()?;
|
||||
if args.is_present("once") {
|
||||
config.once = true;
|
||||
}
|
||||
|
||||
let loglevel = if args.is_present("verbose") {
|
||||
LevelFilter::Debug
|
||||
} else if args.is_present("changes") {
|
||||
LevelFilter::Info
|
||||
} else {
|
||||
LevelFilter::Warn
|
||||
};
|
||||
|
||||
CliHandler::new(config, loglevel, args.is_present("notif"))
|
||||
}
|
||||
|
||||
// until 2.0
|
||||
#[cfg(windows)]
|
||||
fn default_shell() -> Shell {
|
||||
Shell::Cmd
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
fn default_shell() -> Shell {
|
||||
Shell::default()
|
||||
}
|
||||
|
||||
// because Shell::Cmd is only on windows
|
||||
#[cfg(windows)]
|
||||
fn cmd_shell(_: String) -> Shell {
|
||||
Shell::Cmd
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
fn cmd_shell(s: String) -> Shell {
|
||||
Shell::Unix(s)
|
||||
Ok(app.get_matches_from(raw_args))
|
||||
}
|
||||
|
|
45
cli/src/config.rs
Normal file
45
cli/src/config.rs
Normal file
|
@ -0,0 +1,45 @@
|
|||
use clap::ArgMatches;
|
||||
use color_eyre::eyre::{eyre, Result};
|
||||
use watchexec::{
|
||||
command::Shell,
|
||||
config::{InitConfig, RuntimeConfig},
|
||||
};
|
||||
|
||||
pub fn new(args: &ArgMatches<'static>) -> Result<(InitConfig, RuntimeConfig)> {
|
||||
Ok((init(&args)?, runtime(&args)?))
|
||||
}
|
||||
|
||||
fn init(args: &ArgMatches<'static>) -> Result<InitConfig> {
|
||||
let mut config = InitConfig::builder();
|
||||
|
||||
Ok(config.build()?)
|
||||
}
|
||||
|
||||
fn runtime(args: &ArgMatches<'static>) -> Result<RuntimeConfig> {
|
||||
let mut config = RuntimeConfig::default();
|
||||
|
||||
|
||||
Ok(config)
|
||||
}
|
||||
|
||||
// until 2.0
|
||||
#[cfg(windows)]
|
||||
fn default_shell() -> Shell {
|
||||
Shell::Cmd
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
fn default_shell() -> Shell {
|
||||
Shell::default()
|
||||
}
|
||||
|
||||
// because Shell::Cmd is only on windows
|
||||
#[cfg(windows)]
|
||||
fn cmd_shell(_: String) -> Shell {
|
||||
Shell::Cmd
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
fn cmd_shell(s: String) -> Shell {
|
||||
Shell::Unix(s)
|
||||
}
|
|
@ -1,20 +1,35 @@
|
|||
use std::io::Write;
|
||||
use std::env::var;
|
||||
|
||||
use color_eyre::eyre::Result;
|
||||
use watchexec::watch;
|
||||
use tracing_subscriber::filter::LevelFilter;
|
||||
use watchexec::Watchexec;
|
||||
|
||||
mod args;
|
||||
mod handler;
|
||||
mod config;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
color_eyre::install()?;
|
||||
let handler = args::get_args()?;
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
color_eyre::install()?;
|
||||
|
||||
env_logger::Builder::new()
|
||||
.format(|buf, r| writeln!(buf, "*** {}", r.args()))
|
||||
.filter(None, handler.log_level)
|
||||
.init();
|
||||
if var("RUST_LOG").is_ok() {
|
||||
tracing_subscriber::fmt::init();
|
||||
}
|
||||
|
||||
watch(&handler)?;
|
||||
Ok(())
|
||||
let args = args::get_args()?;
|
||||
|
||||
if args.is_present("verbose") {
|
||||
tracing_subscriber::fmt()
|
||||
.with_max_level(LevelFilter::DEBUG)
|
||||
.try_init()
|
||||
.ok();
|
||||
}
|
||||
|
||||
let (init, runtime) = config::new(&args)?;
|
||||
|
||||
let config = runtime.clone();
|
||||
let wx = Watchexec::new(init, runtime)?;
|
||||
|
||||
wx.main().await??;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue