Oclis - CLI builder based on a simple, obvious specification file

I always wanted a better CLI for Transity, but I don’t like applicative CLI option parsing. (The applicative interface feels kind of “forced”. I can’t see how this makes building a CLI easier or better.) The one it had was just some bare bones, cobbled together, manual arg parsing.

I tried to revive Neodoc (based on docopt - a WYSIWYG kind of way to describe CLI interfaces), but I never finished it. Also, I realized that it didn’t quite support the features I wanted.

Over the last few weeks, I finally found the time and motivation to build the tool I envisioned.

Let me introduce you to Oclis, the “Obvious CLI Specification Format”

It works like this:

  1. cargo install oclis - Install Oclis globally
  2. oclis init - Creates an oclis.ncl specification file in the root of your project.
  3. Adapt the specification file to your liking.
  4. Run oclis build to generate the CLI parsing code in src/Oclis
  5. Define the handler functions for your commands in your Main.purs
    (Check out the main function of Transity for an example.)
  6. Build and use your project as usual :tada:

Long term goals:

  • Support for more languages (JavaScript, Rust, Haskell, …)
  • Also read config files and environment variables during execution
  • Create more performant code
    • Don’t use intermediate JSON, but directly create the CLI Spec type
  • And a big maybe: Directly create a GUI apps from the same specification.
    (I love PureScript’s Flare and Sparkle for this.)

It’s still rough around the edges, but I wanted to hear your feedback rather sooner than later. :smile:

Any contributors would be highly appreciated!
There is a lot of work to be done until it becomes the all encompassing CLI generation tool I envision and I can’t do it alone! :man_bowing: