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

[feature req] Accept more inputs? #129

Open
ComedyTomedy opened this issue Sep 3, 2023 · 3 comments
Open

[feature req] Accept more inputs? #129

ComedyTomedy opened this issue Sep 3, 2023 · 3 comments

Comments

@ComedyTomedy
Copy link

It would be good to accept more input without crashing, and make it slightly simpler to script with wob. I'd suggest:

  • integers continue as normal
  • allow the string "%" at the end of the number, so 0%-100%.
  • accept empty input as if it were 0, so echo | wob would work, (and commands with empty output, too)
  • perhaps accept any other non-empty string as if it were "100". Along with empty-input being zero, this would allow grep | wob without needing sed etc.

The downside of adding these behaviours is that it would be difficult or impossible to add other valid input types in the future, at least without ambiguity. Although I don't think that would be very useful, unless you wanted to accept config changes or commands.

Separate/related thought - Exiting on invalid input isn't particularly helpful anyway, I think I'd prefer that it responds as best it can and keeps running.

@francma
Copy link
Owner

francma commented Sep 3, 2023

Why is it a problem that wob exits on invalid input? My use-case is that I first try if the script piping into wob works and then include it in service manager / sway config / whatever. And once the script works, it shouldn't really randomly break.

@ComedyTomedy
Copy link
Author

This is true! My main idea is to make scripting easier, e.g. in sway/config. It's helped me make some toggles neater, because now a grep can replace [...] && ... || ....

As for the inputs, current wob is fragile but always correct, my proposed wob is robust but might silently coerce bad input. As you say it will only make a difference if underlying tools change, anyway.

I've made a wrapper script that implements this, for my own use. Just thought it might be useful to others :)

It's just an idea, if you're happy with current wob, so am I -- you've made something really useful 😊 thank you!

@Lcchy
Copy link

Lcchy commented Dec 22, 2023

I would also really prefer wob to not exit on invalid input.

Although I do test my scripts it (surprisingly) sometime happens that I miss something and then wob is killed for the session, forcing to either start it manually or restart the whole session for further debugging.

Finally, I don't see how wob exiting is a useful feature in itself, but maybe I am missing some use case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants