Re:Bash functions are better than I thought
by confidantlake on Sunday October 31, 2021 @04:33PM
(#29060141)
I 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.
Re:Bash functions are better than I thought
by gavinray on Sunday October 31, 2021 @05:47PM
(#29060767)
Ah yes, that section.
Hahaha -- fair point. Readable: maybe. Elegant? No. Bash is far from elegant =P
Re:Bash functions are better than I thought
by mdpye on Sunday October 31, 2021 @06:57PM
(#29061287)
I 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...
Re:Bash functions are better than I thought
by Pokepokalypse on Sunday October 31, 2021 @08:08PM
(#29061745)
Or, (thanks, Amazon): `--no-paginate` `--no-cli-pager` (dang that pisses me off! thank goodness for `jq`).
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.