3 ms·
I like to think this thing I wrote isn't so bad and is fairly readable, even if you don't know anything about shell programming: https://github.com/GavinRay97/
by gavinray 5y ago
I like to think this thing I wrote isn't so bad and is fairly readable, even if you don't know anything about shell programming:
https://github.com/GavinRay97/hasura-ci-cd-action/blob/a9731cdcd47848c72d8d3b9d5bc94da30b2a9c19/entrypoint.sh#L20-L146 https://github.com/GavinRay97/hasura-ci-cd-action/blob/a9731...
This is out of necessity. I'm not the sharpest tool in the shed, so I have to go out of my way to write things such that when I come back to them in months or years, I still understand what they do.
For this same reason, is also why I never use shorthand flags for scripts.
I have no clue what IE: "-s -y -o" might do (or even worse, "-syo", dear god my eyes! Also -- is that one special command, or a series of individual commands?!).
But "--silent --assume-yes --output-file" is pretty easy to grok immediately.
- confidantlake 5y agoI agree with you that it seems readable, nice job on it. But there is comment there that says Oh man this is so ugly Not something I would expect in an "elegant" script. Don't think that it is your fault, just it is very hard to write anything elegant in bash.
- gavinray 5y agoAh yes, that section. Hahaha -- fair point. Readable: maybe. Elegant? No. Bash is far from elegant =P
- mdpye 5y agoI would add a variable ENDPOINT, initialised to "" and set to " --endpoint $THEENDPOINTVALUE" if the endpoint value was passed. Then include that in every invocation? Sorry if I missed something in the logic, reading on my phone, but from the comment, this feels like something I do frequently...
- Pokepokalypse 5y agoOr, (thanks, Amazon): `--no-paginate` `--no-cli-pager` (dang that pisses me off! thank goodness for `jq`).