At the risk of performing some minor thread necromancy, I’d like to share the convention for this kind of thing that I’ve been using. This was influenced by looking through the code in Scry, specifically scry.cr.
The project directory structure has the following form:
- project_name.cr (or maybe “driver.cr”)
Then in your
project_name.cr (again, or
driver.cr or whatever):
# do special things like show your CLI
This works really well when using the
OptionParser to create a CLI that can go in another file, like
src/configuration.cr, and be required and called in the driver.
I don’t know if this is actually the kind of solution you’re looking for, but I’ve found that it allows for pretty nice separation of the library from the standalone executable.