Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better help message #193

Open
alexarchambault opened this issue Mar 23, 2020 · 0 comments
Open

Better help message #193

alexarchambault opened this issue Mar 23, 2020 · 0 comments

Comments

@alexarchambault
Copy link
Owner

alexarchambault commented Mar 23, 2020

The help messages generated by case-app are currently rather raw. All the options are printed, without any grouping of related options, with no reflow of text depending on the terminal width, no colors, etc. For example:

$ cs launch --help
Command: launch
Usage: cs launch <org:name:version|app-name[:version]*>
  --main-class | -M | --main  <string>
  --extra-jars  <string*>
        Extra JARs to be added to the classpath of the launched application. Directories accepted too.
  --property | -D  <key=value>
        Set Java properties before launching the app
  --fork  <bool?>

(there's approx. ~70 options like this in this command!)

scopt or picocli could be used as sources of inspiration (there's probably many other libraries worth a look too…)

About implementing that, colors and reflow should just be a matter of changing some methods in Help.

Grouping arguments is more tricky I think, and requires some changes in the typelevel core of case-app. In more detail, I believe it should be possible to group arguments, by

We should then adjust RecursiveConsParser.args, so that it prepends its group (if it has one) to each of the Args it returns.

Lastly, in Help, we can then use the Arg.group of its args to group / show arguments however we want in the help message generated there. I didn't actually try to implement it, hopefully I didn't miss blockers along the way.

Users would then be able to group arguments like

case class Group1(arg: String = "", n: Int = 0)
case class Group2(other: String = "", m: Int = 0)

case class Options(
  @Recurse("Group 1")
    group1: Group1 = Group1(),
  @Recurse("Group 2")
    group2: Group2 = Group2()
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant