[ANN] Clap 0.1.0 (Command-Line Argument Parsing)

I did not know about minicli, thanks for the link!

Clap and minicli indeed share the same approach. Here are some differences I observed.

  • In minicli, the list of arguments is immutable; arguments are not consumed. It is “more pure”.

  • As a consequence, minicli does not seem to support unnamed arguments (also known as positional arguments).

  • As another consequence, in minicli each function takes the list of arguments, which makes it a bit more flexible at the cost of being slightly more verbose.

  • In minicli there is a hash table storing the list of seen arguments. It looks like this means that the immutable list of arguments must thus always be the same if you want to call finalize, which relies on this invariant.

  • minicli does not generate a --help (but it would be possible rather easily).

  • minicli considers that negative numbers are not option names, and is thus capable of handling them more naturally (in Clap you would need to escape the dash).

  • I think that minicli does not consider “-abc” to be equivalent to “-a -b -c”, whereas Clap differentiates short names (starting with a single dash and which can be factorize like that) and long names (starting with two dashes).

  • minicli’s source code is significantly shorter and thus simpler and easier to maintain.

2 Likes