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

✨ Add an option to show `gleam run -m` in the "Usage" section of the default help text. #23

Closed hayleigh-dot-dev closed 4 months ago

hayleigh-dot-dev commented 6 months ago

Lustre's cli tooling will never be distributed outside of the Gleam package and so any of the commands will always be invoked by Gleam. I'd like the ability to indicate this in the usage text so users don't get confused thinking I might have added something to their PATH etc.

  % gleam run -m lustre/try -- --help          
    Compiling lustre
     Compiled in 0.18s
      Running lustre/try.main
  USAGE:
-         lustre/try [ ARGS ] [ --host=<STRING> --include-styles=<BOOL> --port=<INT> ]
+         gleam run -m lustre/try [ ARGS ] -- [ --host=<STRING> --include-styles=<BOOL> --port=<INT> ]

  FLAGS:
          --help                  Print help information
          --host=<STRING>         The host to run the server on
          --include-styles=<BOOL>         Include lustre_ui's sty

It would be extra great if the help text also showed the required (or at least, sometimes required depending on how clap decides to work that day) -- before including flags as I suspect that will be a frequent cause of confusion for folks.

hayleigh-dot-dev commented 6 months ago

As a somewhat hacky workaround, I've realised I can do glint.with_name("gleam run -m lustre/try") and get the output I'm after 😈