There are several CLI libs for Nim. However, when I was choosing the one to use for my Sauer package, I found out that the existing ones were either quite complex or too low-level. I wanted a package that would allow me to think with commands and subcommands instead of parsers, while still not use a ton of macros.
Working on Kraut, I was surprised with how productive its approach to routing turned out to be and I decided to apply it to CLI. And this is how Climate was born.
Climate is like a router but for command line. You define your commands and subcommands like paths and define handlers for them:
let commands = {"command subcommand": handlerProc}
Options and arguments extracted from the command line are passed inside a Context instance.
I can see how Climate could evolve from here, adding argument validation, type casting, and help generation but it's worth noting that it's already quite handy as it is.
Name: Climate
Author: moigagoo
Posting:
There are several CLI libs for Nim. However, when I was choosing the one to use for my Sauer package, I found out that the existing ones were either quite complex or too low-level. I wanted a package that would allow me to think with commands and subcommands instead of parsers, while still not use a ton of macros.
Working on Kraut, I was surprised with how productive its approach to routing turned out to be and I decided to apply it to CLI. And this is how Climate was born.
Climate is like a router but for command line. You define your commands and subcommands like paths and define handlers for them:
Options and arguments extracted from the command line are passed inside a
Context
instance.I can see how Climate could evolve from here, adding argument validation, type casting, and help generation but it's worth noting that it's already quite handy as it is.
See the docs and a full demo in the repo: https://github.com/moigagoo/climate