Updates to YRKShellScriptHelper
I just pushed a few changes to the github repo for my YRKShellScript class, which were prompted by some feedback I have received. It’s super encouraging for me to hear from people interested in this stuff, so please keep it coming, and please let me know why you’re intrigued, either by leaving a comment or sending an email to me at kelan -at- this-domain.
As for the changes, they are bug fixes and small improvements. In order so that I don’t sound like Apple’s release notes, there are some more details in the commit message (where you can also see the diff). A few highlights:
- It now uses the
OptionParser
exception (MissingArgument
andInvalidArgument
) instead of the customArgumentsNotValid
exception, and handles them (and other exceptions when parsing options/arguments) by printing an error and backtrack to the shell. - You can new set
script.exit_status
, then callbreak
to exit early from your script and return an exit status to the shell. This isn’t as elegant as I would like, so I’m going to try to continue to improve it. If you have any suggestions on how it could be better, how you think it should work, or even what you might like to use it for, definitely let me know. - You can request (via passing a param) to get the exit status from the command when doing
#cmd_output
. - More params for forcing/suppressing out that I have found to be useful.
- New
String#escapedFilename
helper method to escape filenames for using in a command.
This bad boy is definitely still a work-in-progress, so I definitely appreciate any and all feedback, and keep checking for updates.