TanklesXL / glint

Gleam command-line argument parsing with flags and automated help text generation.
https://hex.pm/packages/glint
Apache License 2.0
50 stars 7 forks source link

Subcommand and flag descriptions are inconsistently formatted. #28

Closed hayleigh-dot-dev closed 1 month ago

hayleigh-dot-dev commented 5 months ago

When displaying the description for a flag, the description is presented inline:

FLAGS:
    --help          Print help information
    --host=<STRING>     The host to run the server on.
    --no-styles=<BOOL>      When false, lustre/ui's styles will not be included.
    --port=<INT>        The port to run the server on.

Contrast this to the description of a subcommand:

SUBCOMMANDS:
    app
Build and bundle an entire Lustre application. The generated JavaScript module
calls your app's `main` function on page load and can be included in any Web
page without Gleam or Lustre being present.

    component
Build a Lustre component as a portable Web Component. The generated JavaScript
module can be included in any Web page and used without Gleam or Lustre being
present.

I think these should be formatted consistently, and in a way that handles the line-breaks sensibly. Perhaps something like:

SUBCOMMANDS:
    app        Build and bundle an entire Lustre application. The generated JavaScript module
               calls your app's `main` function on page load and can be included in any Web
               page without Gleam or Lustre being present.

    component  Build a Lustre component as a portable Web Component. The generated JavaScript
               module can be included in any Web page and used without Gleam or Lustre being
               present.
TanklesXL commented 5 months ago

oh this would be awesome! i've been wanting to implement some sort of more sophisticated pretty printer for the help text

richard-viney commented 1 month ago

Currently taking a look at improving the indentation and line wrapping here, will do a PR unless someone else is already working on it?

richard-viney commented 1 month ago

PR up! https://github.com/TanklesXL/glint/pull/41

richard-viney commented 1 month ago

I think this issue can be closed now that #41 is merged