Skip to content
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

Standardized 'watch'-like mechanism rather than separate wait_ functions #3

Open
dimo414 opened this issue Apr 17, 2018 · 1 comment
Labels
enhancement New feature or request major

Comments

@dimo414
Copy link
Owner

dimo414 commented Apr 17, 2018

Original report by Michael Diamond (Bitbucket: dimo414).


watch isn't reasonable to use with Bash functions since it invokes the given command as a subprocess. It would be good to emulate a subset of its features in Bash, however, so functions like wait_ext and wait_port could be more standard (and other gems could add other similar utils).

@dimo414 dimo414 added major enhancement New feature or request labels Feb 23, 2020
@dimo414
Copy link
Owner Author

dimo414 commented Oct 7, 2020

Proposal:

Users can define functions in the polling:: namespace, like polling::port_listening, and functions in the notify:: namespace like notify::desktop or notify::email. These can then be composed arbitrarily, and helper wrappers like wait_for or email_once can simplify common use-cases. Bonus if the callback functions can be tab-completable.

Examples:

# Invoke notify::echo once polling::port_listening succeeds, indicating port 80 is up
$ util::watch echo port_listening 80

# Helper for blocking in the current shell (basically just wrapping `util::watch echo ...`)
$ wait_for url http://google.com

# Send an email once task is complete; doesn't block
# wraps util::watch notify::email within a disown ... & subshell
$ email_once process_complete 1234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request major
Projects
None yet
Development

No branches or pull requests

1 participant