Commit graph

105 commits

Author SHA1 Message Date
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
Félix Saparelli
5753e7773f
Formatting 2021-04-11 04:32:58 +12:00
Félix Saparelli
ced37d7617 Expose on-busy-update in cli args 2021-04-11 04:21:47 +12:00
Félix Saparelli
4c29c7a09d
Add --shell option 2021-04-11 02:36:10 +12:00
Félix Saparelli
bbaaff8a1e
Split args from cli in preparation to remove it from lib entirely 2021-04-11 01:33:40 +12:00
Félix Saparelli
31fd818247
Emit log level separately from Args 2021-04-11 01:09:28 +12:00
Shane Fry
949fbcf7ae Add --changes-only option to only print path change information. 2021-04-08 12:52:44 -05:00
Philip Daniels
03142f5ec1 Call init_logger after parsing the args. 2020-06-25 11:16:22 +01:00
Philip Daniels
ebd5ec084f Do not call init_logger from inside watch.
And move init_logger to main.rs for future use.
2020-06-24 15:17:59 +01:00
Félix Saparelli
e33fd8f5b5
Remove borrowing that was introduced in previous release 2019-10-28 22:32:08 +13:00
Félix Saparelli
6c653e8e52
Return owned Args from Handler instead of borrowed 2019-10-28 18:55:39 +13:00
Félix Saparelli
6f473bcd87 [meta] Run formatter 2019-01-26 15:15:27 +13:00
Félix Saparelli
aae5a216b0 [api] Make watchexec take a Handler rather than a callback
Instead of special-casing the callback, which is the path least-taken,
switch the internals to a Handler model, where the default behaviour is
an implementation of a Handler, and external callers can implement their
own Handlers and pass them in.

While doing so, change all unwraps in run::run to returning Errs, and
expand the watchexec Error enum to accommodate. That should make it
easier to use as a library.

Also, differentiate between "manual" and "on update" runs. For now the
only manual run is the initial run, but this paves the way for e.g.
keyboard- or signal- triggered runs.
2019-01-26 14:45:13 +13:00
David Ziegler
7b3daeef9c Major changes for c bindings integration as third party crate (see project: github/InfinityMod/watchexec_c).
Changed version to 1.9.3 for third party crate compatibility detection.
2019-01-23 18:56:09 +01:00
Félix Saparelli
2c5c145042 Extract errors into one thing and return a result more often 2018-09-08 23:51:44 +12:00
Félix Saparelli
a6163cc599 Formatting 2018-09-08 20:08:36 +12:00
Félix Saparelli
718647e386
Merge branch 'master' into fix_panic 2018-09-08 19:43:20 +12:00
Félix Saparelli
39a4a52f80 Restore 1.20 compatibility 2018-08-22 07:14:55 +12:00
Félix Saparelli
ef0e6df8d4 Remove duplication between main/lib files 2018-08-22 00:10:57 +12:00
James Kominick
31b5e56959 don't panic on missing folder
issue #71
- Add some basic error handling
- Convert missing folder panic to error
2017-12-13 23:10:12 -05:00
James Kominick
8bd9bb3c25 detailed update information
issue #59
- Keep track of `notify::op::Op`s associated with each updated path
- Collect paths into `notify::op::Op` categories and pass them on as
  environment vars
- Set a COMMON_PATH and use relative paths if more than one unique
  path was touched
2017-09-09 13:55:44 -04:00
Lilian A. Moraru
e39256cfb2 Update dependencies and other small improvements 2017-08-26 22:07:06 +03:00
Félix Saparelli
f5bf4ef98b
Add library interface 2017-04-25 11:31:50 +12:00
Chris Aumann
ee5e93e6af Add support for --no-shell option 2017-04-10 00:19:58 +02:00
Chris Aumann
264ec282d6 Use a tuple to match scenarios 2017-04-02 21:28:00 +02:00
Chris Aumann
627f828b3c Rename wait_process() to signal_process() 2017-04-02 21:21:30 +02:00
Chris Aumann
c98d0e6cfd Decouple --restart and --signal, so they both make sense
This change takes account of the following four use cases:

1. Make sure the previous run was ended, then run the command again (default)
2. Just send a specified signal to the child, do nothing more (--signal given)
3. Send SIGTERM to the child, wait for it to exit, then run the command again (--restart given)
4. Send a specified signal to the child, wait for it to exit, then run the command again (--restart and --signal given)
2017-04-02 21:21:30 +02:00
Chris Aumann
56ddfcbaee Apply rustfmt-0.8.1 2017-04-02 21:21:30 +02:00
Chris Aumann
a2f6b0013f Add windows compatibility 2017-04-02 21:19:53 +02:00
Chris Aumann
4adde457dd Actually use signal specified in --signal option 2017-04-02 21:19:53 +02:00
Chris Aumann
24e9b0c1c5 Migrate to nix::sys::signal::Signal 2017-04-02 21:19:52 +02:00
Chris Aumann
68caf04269 First commit to add a generic --signal flag 2017-04-02 21:19:52 +02:00
Matt Green
125e7eb7c8 rustfmt & clippy fixes 2017-02-04 16:26:59 -05:00
Matt Green
e16a6b3a24 Support watching multiple paths 2017-02-04 16:18:02 -05:00
Matt Green
53c1f39919 Load + handle multiple .gitignore files in project dir 2017-02-04 14:53:27 -05:00
Matt Green
b2b0a60ca5 Add -1 option for integration testing, closes #35 2017-01-27 15:27:44 -05:00
Matt Green
ebcb5976ba Use globset for ignore matching; closes #14 and #23 2017-01-27 13:00:13 -05:00
Matt Green
171132a722 rustfmt & clippy fixes 2016-12-20 12:20:21 -05:00
Matt Green
b2c809c87a SIGCHLD handling 2016-12-20 11:44:18 -05:00
Matt Green
a925cb356a Fix sending SIGKILL by default when restarting processes 2016-12-19 15:36:59 -05:00
Matt Green
9c65e816da Add -k option to send SIGKILL instead of SIGTERM; closes #31 2016-12-19 11:37:20 -05:00
Matt Green
154c23a5a4 Propagate SIGTSTP/SIGCONT to children 2016-12-14 20:19:58 -05:00
Matt Green
54baf4e384 Add process::spawn function 2016-11-23 12:59:56 -05:00
Matt Green
f768721ca3 Remove --watch option, always watch cwd 2016-11-17 08:45:55 -05:00
Matt Green
3bf3086a29 Replace before_exec with fork/exec, removing Rust nightly requirement 2016-11-15 16:55:29 -05:00
Matt Green
bdce629782 Drop size optimizations that require nightly builds 2016-11-13 18:34:23 -05:00
Matt Green
0ef334e2a1 Size optimizations 2016-11-10 19:43:13 -05:00
Matt Green
2d2a8cb079 rustfmt 2016-11-09 17:25:52 -05:00
Matt Green
6523f6edf5 Cleanup, initial Windows implementation of interrupt handler 2016-11-09 17:00:24 -05:00
Matt Green
cf0a98b7a5 Remove use of select! 2016-11-09 09:44:00 -05:00