www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - JCLI release v0.21.1

reply SealabJaster <sealabjaster gmail.com> writes:
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

* 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 

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

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

     * Automatic error messages for missing and malformed 

* 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 

     * 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 

     * 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 

* 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 

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

Any thoughts and comments are welcome.
Aug 25 2021
parent SealabJaster <sealabjaster gmail.com> writes:
On Wednesday, 25 August 2021 at 09:18:50 UTC, SealabJaster wrote:
Oh, I'd also like to redocument the code. The old code was almost 50% comments or something, and the rewrite has almost no comments.
Aug 25 2021