I've rewritten JCLI, and this is the first release where I think it's useable again: https://code.dlang.org/packages/jcli

Here's a snippet from the README

# Features

* Building:

* This library was primarily built using [Meson](https://mesonbuild.com) as the build system, so should be fully integratable into other Meson projects.

* All individual parts of this library are intended to be reusable. Allowing you to build your own CLI core using these already-made components, if desired.

* All individual parts of this library are split into sub packages, so you can only include what you need if you're not using the main `jcli` package.

* Argument parsing:

    * Named and positional arguments.

    * Boolean arguments (flags).

    * Optional arguments using the standard `Nullable` type.

* User-Defined argument binding (string -> any_type_you_want) - blanket and per-argument.

* User-Defined argument validation (via UDAs that follow a convention).

* Pass through unparsed arguments (`./mytool parsed args -- these are unparsed args`).

* Capture overflowed arguments (`./mytool arg1 arg2 overflow1 overflow2`)

* Automatic error messages for missing and malformed arguments.

* Commands:

* Standard command line format (`./mytool command args --flag=value ...`).

    * Automatic command dispatch.

    * Defined using UDAs, and are automatically discovered.

    * Supports a default command.

* Supports named commands that allow for multiple words and per-command argument parsing.

    * ~~Support for command inheritance~~ (currently broken).

    * Only `structs` are allowed for the moment.

* Help text:

* Automatically generated with slight ability for customisation.

    * Works for the default command.

    * Works for exact matches for named commands.

    * Works for partial matches for named commands.

    * Arguments can be displayed in organised groups.

* Utilities:

    * Bash completion support. (will be reimplemented soon)

* Decent support for writing and parsing ANSI text via [jansi](https://github.com/BradleyChatha/jansi).

* An ANSI-enabled text buffer, for easier and efficient control over coloured, non-uniform text output.

In the future I'd like to get a few things done, namely:

* Reimplement bash completion.

* Reimplement command partial match completion (right now it'll just display every command known)

* Maybe add back in dependency injection and a basic configuration interface, but I'm not sure it was ever really useful.

* Add more tooling for text output. Progress bars, tables, etc.

* Figure out how I want to handle arguments that are of an array type. Currently because arg binding is extensible you can implement your own solutions, but I'd like a default, built-in one.

* Make sure there's no leftovers in the README of the pre-rewrite version of JCLI.

Any thoughts and comments are welcome.
  • JCLI release v0.21.1 SealabJaster via Digitalmars-d-announce

Reply via email to