New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watchman-make: add --run option as alternative to --make #232

Closed
sebm opened this Issue Mar 15, 2016 · 10 comments

Comments

Projects
None yet
4 participants
@sebm
Copy link

sebm commented Mar 15, 2016

I use watchman-make to automatically trigger a script on filesystem changes, which I've accomplished in a fairly hacky way:

watchman-make -p '**/*.js' '**/*.css' --make my_script.sh -t ''

The -t '' is necessary because otherwise I get the error

No targets were specified, nothing to do.

Would you consider allowing an empty target or at least a --no-target flag for this kind of use case? I could even write it myself, I just want to make sure it conforms to your design standards.

@wez

This comment has been minimized.

Copy link
Contributor

wez commented Mar 16, 2016

It works this way because it is intended to be used primarily with a build tool that you can instruct to make (potentially) multiple different targets.

I'm amenable to making a simpler UI for non-make use cases, how about something like:

watchman-make -p '**/*.js' '**/*.css' --run my_script.sh

that will just run my_script.sh when any of the matching patterns change.

Does that sound good to you? If so, would you like to submit a pull request to implement that?

@sebm

This comment has been minimized.

Copy link

sebm commented Mar 16, 2016

Hey @wez, that would work for me. I'm amenable to making a pull request when I get a chance…watch this space.

@wez

This comment has been minimized.

Copy link
Contributor

wez commented Mar 16, 2016

Looking forward to it, thanks!

@joseluisq

This comment has been minimized.

Copy link

joseluisq commented Apr 1, 2016

@wez --run option is a great idea.
But, Is there any alternative way to do this with the current release?
Thanks.

@wez

This comment has been minimized.

Copy link
Contributor

wez commented Apr 6, 2016

@joseluisq the original post shows exactly how to do this today

@wez wez added the enhancement label Apr 15, 2016

@joseluisq

This comment has been minimized.

Copy link

joseluisq commented May 26, 2016

@joseluisq the original post shows exactly how to do this today

Yeah works thanks!

@wez wez changed the title watchman-make doesn't accept empty --target watchman-make: add --run option as alternative to --make Jul 26, 2016

@TDAbboud

This comment has been minimized.

Copy link
Contributor

TDAbboud commented Jan 19, 2017

I got around to implementing this feature and submitted a PR #425. I would appreciate any feedback.

@joseluisq

This comment has been minimized.

Copy link

joseluisq commented Jan 19, 2017

@TDAbboud awesome!

facebook-github-bot added a commit that referenced this issue Jan 20, 2017

add a --run option to execute a given script
Summary:
This option provides an alternative to the --make
flag. You can now specify a pattern and provide
the path to a script to run upon changes being detected.
Ex:
    `watchman-make -p '*.c' '*.h' --run my_script.sh`

Implements #232
Closes #425

Differential Revision: D4442065

Pulled By: wez

fbshipit-source-id: e1e0d122856951eae65d177ebe25ce7cc80077ef
@wez

This comment has been minimized.

Copy link
Contributor

wez commented Jan 20, 2017

This will be included in the 4.8 release which should happen in the next week or so

@wez wez closed this Jan 20, 2017

@sebm

This comment has been minimized.

Copy link

sebm commented Jan 20, 2017

Thank you @TDAbboud !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment