I recommend reading Shopify CEO Tobi's try[0] for good example of how Ruby's block behavior and meta-programming makes it easy to create a single file, shell wrapper.
[0]: https://github.com/tobi/try/blob/main/try.rb
what the fuck...