▲ | Show HN: Attempt – A CLI for retrying fallible commands(github.com) | |||||||||||||||||||||||||
67 points by maxbond 3 days ago | 19 comments | ||||||||||||||||||||||||||
Hi HN, Here's a tool I wrote for retrying fallible commands. Nothing groundbreaking here, this is a tool that's been made many times (and several have been submitted to Show HN). Though this one does have a more comprehensive feature set than most. I hope one or two people will find it useful. I wrote `attempt` for two reasons: - To have a more featureful alternative to `wait-for-it.sh` for use in Docker Compose. Specifically to apply migration scripts to a database that may not be up yet. I wanted to be able to inspect the error messages from my migration tool & retry on connection errors. - To test a hypothesis I had that a good way to make a CLI was to copy the API of a good library (in this case, `tenacity`). I want to write a blog post at some point to discuss this at length, but the tl;dr is that I believe it was a success. Here are some usage examples: https://maxbondabe.github.io/attempt/usage.html There may not be much to discuss for such a small tool, but I am open to all feedback and am happy to answer any questions. Cheers, Max | ||||||||||||||||||||||||||
▲ | NightMKoder 3 days ago | parent | next [-] | |||||||||||||||||||||||||
I was recently in the market for one of these! I ended up going with https://github.com/dbohdan/recur due to the nice stdout and stdin handling. Though this has stdout/stderr pattern matching for failures which is nice too! | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
▲ | nickdothutton 3 days ago | parent | prev | next [-] | |||||||||||||||||||||||||
I am reminded of the lack of really strong batch/job control of the sort I enjoyed as far back as VAX VMS at university, anything that brings a stronger capability to modern OS is welcome. This is I think a big missing thing. | ||||||||||||||||||||||||||
▲ | brirec 3 days ago | parent | prev | next [-] | |||||||||||||||||||||||||
This is kind of neat. I appreciate how well it falls into the whole Unix philosophy of small tools that do one thing really well. One thing I’m kind of curious about from a UI standpoint is why the exponential argument isn’t a double-hyphen flag. It kind of feels like it should be, given all of the other arguments are flags. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
▲ | jalk 3 days ago | parent | prev | next [-] | |||||||||||||||||||||||||
This is useful. Don't want to think about how many times I have implemented retrying in shell scripts. I appreciate the extensive documentation, but I would suggest adding the output of `attempt --help` to the README / docs, so that features can be discovered at a glance. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
▲ | juliangmp 3 days ago | parent | prev | next [-] | |||||||||||||||||||||||||
This looks nice Maybe I can finally replace that sshtry shell function which I've been using for a few years | ||||||||||||||||||||||||||
▲ | lloydatkinson 3 days ago | parent | prev | next [-] | |||||||||||||||||||||||||
> `wait-for-it.sh` for use in Docker Compose. Any time I hear people praising all these orchestrators, whether it's Docker, K8, or whatever, I remember that a good amount of it is all lies built with glue and sticks like "wait-for-it.sh". | ||||||||||||||||||||||||||
▲ | dannyobrien 3 days ago | parent | prev | next [-] | |||||||||||||||||||||||||
This great! Thank you for writing it. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
▲ | adastra22 3 days ago | parent | prev [-] | |||||||||||||||||||||||||
Is “try” taken as a CLI command? Seems like a better name. | ||||||||||||||||||||||||||
|