|
|
|
|
|
by rustyminnow
1907 days ago
|
|
This is super cool. There's so much good stuff in there I'm gonna have to come back a few times just to digest it all! Also looking forward to some of the links at the bottom. Do you have a standard template you use for your scripts? You kind of touch on this in section 4.20.1 but don't go too deep. Also have you done any work with writing zsh (or bash) completions? I feel like having good completions would make my scripts magnitudes more handy, but I've had trouble finding good starter resources. |
|
https://pastebin.com/FYMmnZ0B
At the start it provides a stacktrace function which can also be used to notify you if your script has failed (e.g. via xmpp, e-mail, etc.). It is not my own creation, as I found it somewhere a few years ago, but found it super useful over time.
In addition, there are two versions for checking for dependencies. The first lets you communicate instructions for every tool that is required while the second can be used if you simply want to communicate the list of programs that is missing.
The third part is about named parameters, which can be helpful if you don't want to use positional parameters.