Commit Graph

361 Commits

Author SHA1 Message Date
Félix Saparelli 8f61ac31da
Prep fs pathset for future 2021-10-15 01:38:21 +13:00
Félix Saparelli 14b0364135
Get filetype filters actually working 2021-10-14 01:26:15 +13:00
Félix Saparelli ae6af17aea
Find and load all ignores for watchexec cli 2021-10-14 00:38:56 +13:00
Félix Saparelli 87b6729ab7
Add utility ProjectType::{is_vcs,is_soft} and project::common_prefix fns 2021-10-14 00:14:31 +13:00
Félix Saparelli f24e95504b
Fix panic in tagged filtering 2021-10-14 00:13:48 +13:00
Félix Saparelli c6336cdf3c
Add filetype matcher 2021-10-13 04:06:55 +13:00
Félix Saparelli fb4f136c0d
Match path globs 2021-10-13 04:06:39 +13:00
Félix Saparelli 758ac2dc89
Change panic into a todo 2021-10-13 01:51:09 +13:00
Félix Saparelli fd2edbf11c
Compile gitignore patterns 2021-10-13 01:49:38 +13:00
Félix Saparelli c9da2c133a
Harmonise root/origin 2021-10-13 01:49:11 +13:00
Félix Saparelli f16ba2dff1
Redo and sketch new filter adding process 2021-10-13 00:48:42 +13:00
Félix Saparelli cd7d5f1fcb
Draft and plan ignore loading 2021-10-11 23:34:14 +13:00
Félix Saparelli 3c65aee839
Find project types 2021-10-10 23:35:27 +13:00
Félix Saparelli 1dff1f5644
Find project origins more efficiently 2021-10-10 23:35:11 +13:00
Félix Saparelli 59fe74656a
Stop using eyre even in examples 2021-10-10 21:04:40 +13:00
Félix Saparelli 7af0339871 Detect project origins (if any) 2021-10-10 17:56:49 +13:00
Félix Saparelli 3219be53f5
Add support for bazaar global ignores 2021-10-10 16:06:56 +13:00
Félix Saparelli 65b042ec8f
Discover ignore files for path and for user/env 2021-10-10 16:03:05 +13:00
Félix Saparelli 8bc58ba6b5
Start sketching gitignore support 2021-10-09 18:45:32 +13:00
Félix Saparelli a1fce1b06e
Replace eyre with miette
and upgrade it to 3.2.0
2021-10-09 18:43:51 +13:00
Félix Saparelli 323f2d29ee
Split off filter errors into their own type(s) 2021-10-09 18:41:45 +13:00
Félix Saparelli 3dff065f4b
Add error variants for external custom errors 2021-10-09 18:38:37 +13:00
Félix Saparelli 81bee9513d
Remove derive-builder
* the InitConfigBuilder non-miette error goes away
* creating an InitConfig is no longer faillible for no reason
* the "builder" style is consistent between the two config structs
2021-10-09 18:37:59 +13:00
Félix Saparelli 07878f8357
Implement path filtering 2021-09-30 04:03:46 +13:00
Félix Saparelli 288ce9d2f4
== and != perform case-insensitive comparisons 2021-09-30 02:34:27 +13:00
Félix Saparelli d6b7175bb1 Formattting 2021-09-29 23:43:39 +13:00
Félix Saparelli 45a7ce6aa0
Fix logic error and upgrade warn to panic in debug 2021-09-28 23:44:28 +13:00
Félix Saparelli 6b306a15ab
Add event saturation notes 2021-09-28 22:52:59 +13:00
Félix Saparelli 7cdb6ac5ad
Bypass filters for empty events 2021-09-28 22:23:48 +13:00
Félix Saparelli f492bca8c3
Add filter add/del error to runtime 2021-09-28 22:23:23 +13:00
Félix Saparelli 9bb6e1356a
Add is_empty and is_internal to Event 2021-09-28 22:22:33 +13:00
Félix Saparelli f673d00e9c
Add logging to filter parser 2021-09-28 22:22:14 +13:00
Félix Saparelli f3c74bd151
Add methods to configure tagger filter 2021-09-28 22:21:51 +13:00
Félix Saparelli 4fda3c477b
Add logging to tagged filter 2021-09-28 22:21:13 +13:00
Félix Saparelli 6e414d1de4
Change the default of Shell 2021-09-28 01:44:20 +13:00
Félix Saparelli 2c894266a8
Add negation filters, and filter application 2021-09-28 00:54:33 +13:00
Félix Saparelli b57fa8b236 Start implementing two Filterers (v1 and v2) 2021-09-23 21:59:35 +12:00
Félix Saparelli 7875b4db67
Provide filterer as trait
which will allow basically anything user-provided as filter, though of
course we'll have (soon) our own fairly comprehensive implementation
2021-09-22 23:39:41 +12:00
Félix Saparelli f1685821a3
Split types out of action 2021-09-18 17:20:05 +12:00
Félix Saparelli 29d0b66ba9
Move filter types out 2021-09-18 17:09:00 +12:00
Félix Saparelli 2be21b6bac
Move filter parser out 2021-09-18 17:07:32 +12:00
Félix Saparelli 84dc77f787 Add parser for filters 2021-09-14 20:11:29 +12:00
Félix Saparelli 6a55f5cc6d
Start on filter types 2021-09-13 19:51:07 +12:00
Félix Saparelli 9e3c8c1f32
Rename particle/culars to tags 2021-09-13 19:34:40 +12:00
Félix Saparelli e5fcc6553e
Also leave alt buffer on reset 2021-09-04 02:00:57 +12:00
Félix Saparelli 4043ed34ae
Add Reset outcome (#186, #211) 2021-09-04 01:55:25 +12:00
Félix Saparelli 645ab74c62
Implement Outcome::Wait, and CLI on-busy=queue 2021-09-03 09:25:23 +12:00
Félix Saparelli b923638cbd
Correctly watch for process completion 2021-09-03 09:25:06 +12:00
Félix Saparelli 9c8d4c1a1b
Add fs event metadata to event 2021-09-03 08:14:04 +12:00
Félix Saparelli 5cbbb7b67f
Add Display impl for events 2021-09-03 07:57:59 +12:00
Félix Saparelli 608aa516b1
Add source to internal event 2021-09-03 07:57:45 +12:00
Félix Saparelli ec6b508894
Ignoring supervisor kill/signal internal errors
As the errors only occur when the process is dead anyway
2021-09-03 05:43:26 +12:00
Félix Saparelli b728bfecfc
Differentiate trace logs when ending supervisor 2021-09-03 05:42:24 +12:00
Félix Saparelli f880b0b38a
Always apply Both outcomes, even when the first fails 2021-09-03 05:41:50 +12:00
Félix Saparelli 8e4994abca
Add process supervisor to watch command to completion
Also change the concept of a completion handler to instead sending a
synthetic "process completed" event down the same path as usual.

That makes handling completion the job of the action handler, but also
means it's immediately possible to launch a process or do an action in
response to the process completing. Win win!
2021-09-03 05:22:15 +12:00
Félix Saparelli 0f247e9e5c
Fix demo for poll option gaining a timeout 2021-09-03 05:18:30 +12:00
Félix Saparelli ef453193af
Add pre-spawn and post-spawn hooks 2021-08-25 04:41:14 +12:00
Félix Saparelli 6767948daa
Specify delay for fs Poll mode 2021-08-24 22:28:29 +12:00
Félix Saparelli 33fb691d29
Add method to insert events into watchexec manually 2021-08-24 22:20:44 +12:00
Félix Saparelli 9cb1f5bf79
Re-export Outcome's Signal type 2021-08-24 21:31:46 +12:00
Félix Saparelli 23d794ed7e
Apply tabs project-wide 2021-08-24 20:22:25 +12:00
Félix Saparelli 33f8b60e46
Take IntoIterator<AsRef<str>> to be more flexible on input 2021-08-24 20:14:01 +12:00
Félix Saparelli 05afb141b6
Add InitConfig::builder() to be a little more idiomatic
Neat side effect: keeps rust-analyzer from complaining about unknown types
(because it doesn't expand the builder macro)!
2021-08-24 19:59:11 +12:00
Félix Saparelli b4ead7f5fb
Report several runtime errors if notify gives us several paths in an error 2021-08-23 06:08:25 +12:00
Félix Saparelli 3588cb4d62
Log fs watch/unwatch errors harder (to reveal paths) 2021-08-23 05:15:55 +12:00
Félix Saparelli 6cb3fc1c9a
Demo switching file watcher backends at runtime 2021-08-23 03:59:02 +12:00
Félix Saparelli 4a9168f5e6
Log on graceful exit 2021-08-23 03:36:10 +12:00
Félix Saparelli 9b94f18890
Fix double-actioning in throttle 2021-08-23 03:12:23 +12:00
Félix Saparelli b42336cb74
Actually watch files in example 2021-08-23 03:11:58 +12:00
Félix Saparelli b2effda341
Update to miette 1.0 beta 2021-08-23 02:37:13 +12:00
Félix Saparelli 5314d201a4
Expand print_out example into watchexec test case 2021-08-23 02:36:58 +12:00
Félix Saparelli 74d8e73817
Fix tokio panic for async handlers 2021-08-23 02:35:28 +12:00
Félix Saparelli 931648a955
Add signals() convenience iter on Event 2021-08-23 02:35:03 +12:00
Félix Saparelli cc5b1c988e
Add some logging to Process 2021-08-23 02:34:44 +12:00
Félix Saparelli 60ed6bba25
Fix infinite loop in action recv code 2021-08-23 02:34:29 +12:00
Félix Saparelli 05117e69fe
Prep for more handlers in action 2021-08-23 02:33:23 +12:00
Félix Saparelli 4843920a36
Protect again starting command without anything in command 2021-08-23 02:32:48 +12:00
Félix Saparelli 17b09d8798
Add graceful exit support 2021-08-23 02:32:08 +12:00
Félix Saparelli f4a8a9fc6a
Print PID in initialisation 2021-08-23 02:30:56 +12:00
Félix Saparelli 18d2487ec3
Rename reconfig to reconfigure 2021-08-23 00:31:39 +12:00
Félix Saparelli 3066ee5913
Implement most of process handling 2021-08-23 00:28:20 +12:00
Félix Saparelli f150c26b22
Add action.grouped config 2021-08-23 00:27:45 +12:00
Félix Saparelli d2d0bb7be2
Resolve compound outcomes 2021-08-22 23:23:01 +12:00
Félix Saparelli 7a709b9b4d
Prefer generic Both combinator than specific ClearAnd 2021-08-22 23:22:27 +12:00
Félix Saparelli c85c164c09
Make the example in lib.rs compile 2021-08-22 22:06:50 +12:00
Félix Saparelli 227c2a0e0d
Add command and shell options to action 2021-08-22 22:06:31 +12:00
Félix Saparelli 613fe24c64
Add paths() convenience iter on Event 2021-08-22 22:06:12 +12:00
Félix Saparelli 8998c40746
Add convenience methods for Outcome's combinators 2021-08-22 22:05:45 +12:00
Félix Saparelli d7d549a4c8
Add convenience modifiers on RuntimeConfig ourselves
It's not exactly a builder, and this lets us flatten all the options at the
top level instead of requiring the user to dig deeper into the
action, fs, etc modules' WorkingData structs.
2021-08-22 22:05:09 +12:00
Félix Saparelli 6c3c06e39c
Stop using Builder for RuntimeConfig 2021-08-22 20:49:24 +12:00
Félix Saparelli 53854d93d4
Change Outcome::OrStart to the more flexible ::IfRunning 2021-08-22 20:47:47 +12:00
Félix Saparelli 656c0d8fd2
Fix action throttling
Specifically, on loop start the timeout would be for the full throttle duration,
which is not correct if some time has passed or the loop goes on recycle
2021-08-22 20:29:57 +12:00
Félix Saparelli 40f6f7397f
Fill out Outcome 2021-08-22 20:27:51 +12:00
Félix Saparelli 5b8611a8c0
Make notes on needed docs 2021-08-22 20:26:48 +12:00
Félix Saparelli 350b85e0c7
Allow an outcome to be determined by the action handler without &mut! 2021-08-22 18:56:57 +12:00
Félix Saparelli 2a0661b122
Call action handler on action 2021-08-22 05:58:03 +12:00
Félix Saparelli 2812a723ff
Write action throttling code 2021-08-22 02:54:02 +12:00
Félix Saparelli ce60be2ec9
Add print_out example 2021-08-22 02:53:31 +12:00
Félix Saparelli f2f138ce9f
Add logging to Watchexec 2021-08-22 02:53:20 +12:00
Félix Saparelli 019018c93e
Add docs for error_handler as it's a bit tricky 2021-08-21 22:30:19 +12:00
Félix Saparelli 816313303a
Finish handlers by implementing the error hook 2021-08-21 20:46:44 +12:00
Félix Saparelli 0f37e42243
Add action worker 2021-08-21 04:43:55 +12:00
Félix Saparelli dcde429787
Improve handlers to not need GATs and provide various impls 2021-08-21 04:43:15 +12:00
Félix Saparelli 9f34492c79
Upgrade to notify pre.12 2021-08-20 02:59:39 +12:00
Félix Saparelli 95ad3e91ff
Add example / aspirational usage to lib doc 2021-08-20 02:56:13 +12:00
Félix Saparelli 6a46c2bff3
Refactor watchexec to only have &self methods and default to wrap it in Arc 2021-08-20 02:55:34 +12:00
Félix Saparelli 249c581dc9
Make channel buffers configurable 2021-08-19 21:28:56 +12:00
Félix Saparelli 5d11ccaa71
Add a bit more structure via documentation 2021-08-19 20:44:02 +12:00
Félix Saparelli 319729582f
Split signal and fs examples 2021-08-19 20:31:29 +12:00
Félix Saparelli 6f3abdeaea
Add RuntimeError::from_handler utility 2021-08-19 20:30:35 +12:00
Félix Saparelli 4e4a8e6853
Add Handler trait 2021-08-19 20:30:01 +12:00
Félix Saparelli 0bb38f40a5
Start off on main interface 2021-08-19 01:12:50 +12:00
Félix Saparelli 826dbd8cda
Make fs::worker Send 2021-08-19 00:40:35 +12:00
Félix Saparelli cae00070fb
Remove chrono dep 2021-08-18 18:54:05 +12:00
Félix Saparelli 0237a568df
Handle signals into events 2021-08-17 21:41:13 +12:00
Félix Saparelli f5e19a6e5f
Adapt Shell command builder 2021-08-17 03:09:22 +12:00
Félix Saparelli 7053360187
Clarify fs worker usage 2021-08-17 01:37:01 +12:00
Félix Saparelli 822148da03
Canonicalise paths + add example 2021-08-17 01:15:17 +12:00
Félix Saparelli f08bdad8ee
Use local datetime on events instead of naive 2021-08-16 21:52:13 +12:00
Félix Saparelli b15615bbaa
Start on watchexec v2 2021-08-16 21:49:12 +12:00
Félix Saparelli 3208652ed8
Add citation.cff 2021-07-29 00:45:13 +12:00
Félix Saparelli bd96803d1e lib: v1.17.1 2021-07-22 01:36:33 +12:00
Félix Saparelli 0ab1405186
Ignore errors when killing command on pre-spawn 2021-07-22 01:36:19 +12:00
Félix Saparelli bf922e36ac lib: v1.17.0 2021-07-22 01:15:46 +12:00
Félix Saparelli d8fb70c454
Cease with the 2015-style #[macro_use]s 2021-07-22 01:01:11 +12:00
Félix Saparelli ef36d3429d
Fix expectation in windows path test 2021-07-22 00:47:52 +12:00
Félix Saparelli 73eef67206
Don't rely on bash being installed for windows tests 2021-07-22 00:47:02 +12:00
Félix Saparelli 3485bd7e16
Add windows tests for path/env handling 2021-07-22 00:40:05 +12:00
Félix Saparelli f88c30b854
Another windows test fix 2021-07-22 00:22:39 +12:00
Félix Saparelli 18fdbbcfea Merge branch 'docs/website' 2021-07-22 00:18:13 +12:00
Félix Saparelli 85e2c12c34
Review readmes, add website links 2021-07-22 00:13:59 +12:00
Félix Saparelli 665f5ef6f0
Remove binstall metadata from the lib 2021-07-21 23:55:10 +12:00
Félix Saparelli d59a76182a
Remove cargo install stub 2021-07-21 23:54:42 +12:00
Félix Saparelli 392547ffa4
Fix typo 2021-07-21 23:47:16 +12:00
Félix Saparelli f5a92220c9
Drop debounce to 100ms (#168) 2021-07-21 23:44:24 +12:00
Félix Saparelli eb59e92b8f
Add support for disabling process groups (#158) 2021-07-21 23:38:42 +12:00
Félix Saparelli bb6a5ae891
Split process.rs into shell and paths
(now that the bulk of process code is gone)
2021-07-21 23:37:24 +12:00
Félix Saparelli 72cda2b0b0
Make sure to kill the old command group before starting a new one 2021-07-21 21:42:55 +12:00
Félix Saparelli 9c20c8c8b5 Replace process code with command-group 2021-07-21 20:22:40 +12:00
Félix Saparelli 4d6ad2cc1f
Use website as source for docs logo 2021-07-20 20:32:38 +12:00
Félix Saparelli 847520357c
Rename ignore test fns 2021-07-17 01:33:39 +12:00
Félix Saparelli 7b16a226b2 lib: v1.16.1 2021-07-10 20:04:31 +12:00
Félix Saparelli ba26999028 Pin globset version to avoid breakage
Breakage caused by this fix: https://github.com/BurntSushi/ripgrep/pull/1756

The fix is correct, but it does break a lot of stuff :/
2021-07-10 20:02:37 +12:00
Félix Saparelli 604c24ec38 Link to website for downloads 2021-07-10 03:48:12 +12:00
Félix Saparelli 08d795f841 Remove stub main.rs from library 2021-07-10 03:48:12 +12:00
Félix Saparelli 585f73adde Poll process completion harder on windows 2021-07-10 03:43:21 +12:00
Félix Saparelli 71a178d4c2 Actually check process when querying for completion
With --on-update=do-nothing, we need to know when the process is done
before we can spawn a new one, but we never actually used to truly check
the process, only the presence or absence of a spawned process. That
process may have already completed, but because we don't wait on it when
in do-nothing mode, there is no opportunity to notice this.

So now we either actually check the completion status of the process (on
Windows), or we expose the `done` mutex value on demand (Unix).
Essentially this adds a way to check the completion status of the
process without blocking (modulo a mutex lock on unix).

Fixes #200
2021-07-10 03:43:21 +12:00
Félix Saparelli f0862b9f1e Update to clearscreen 1.0.4 for bugfix 2021-05-22 19:59:32 +12:00
Félix Saparelli d8540d76b8
Fomat and clippy 2021-05-10 23:37:03 +12:00
Félix Saparelli ad9f51a24b lib: v1.16.0 2021-05-09 03:46:23 +12:00
Félix Saparelli c517b98782 Split readmes 2021-05-09 03:44:11 +12:00
Félix Saparelli 148be31f65
Add a stub to the watchexec (lib) crate to point to the watchexec-cli crate 2021-05-09 01:19:50 +12:00
Félix Saparelli 8295ac7a1c Don't fail CI on clippy warnings 2021-05-08 19:22:35 +12:00
Félix Saparelli 6aebd9b3e7 Formatting 2021-05-08 19:12:13 +12:00
Félix Saparelli 07f56ac7d5
Refactor inotify max watches warning to be less nested and satisfy clippy better 2021-05-08 19:07:56 +12:00
Félix Saparelli d23261673b
Update clearscreen 2021-05-08 18:43:12 +12:00
Félix Saparelli 149b9b9821
Split the versioning of the lib and cli (in theory) 2021-05-01 04:22:33 +12:00
Félix Saparelli aeab4159d4
Change semver policy for the library 2021-05-01 03:56:16 +12:00
Félix Saparelli 181ca7b5c5
Change crate description for library 2021-05-01 03:47:22 +12:00
Félix Saparelli aff9f2d8f2
Leave binstall config on the lib crate for now 2021-05-01 03:46:36 +12:00
Félix Saparelli 1f3f4ada35 Split into two crates: lib and cli
That has a number of advantages:

- #193 the build.rs is only run for the CLI, so the Windows manifest is
  not embedded in the library anymore, opening it up for downstreams.

- it sets the stage for decoupling the version numbers of the CLI and
  library, to have the library increase its major more often, while the
  CLI retains compatibility further… that is, to have both follow semver

- it removes the CLI-only dependencies from the library

- it makes compilation a bit faster as compiling the library and the
  CLI's other dependencies can happen in parallel

One major disadvantage:

- installing via cargo changes from watchexec to watchexec-cli. Most
  installs are from prebuilt and from packages, but that's still a
  potential stumble.

And of course, the CLI APIs in the library are gone (they were already
deprecated, though).

We also take this opportunity to get rid of the clear_screen code and
use our new clearscreen library. #99 #171 #185
2021-05-01 03:27:17 +12:00