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()
)
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:
(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
val group: String = ""argument toRecurse,recurse: HListargument toHListParserBuilder.apply, and passing itrecursearound here,group: List[String]field toArg,group: Option[String]field toRecursiveConsParser,HListParserBuilder.hconsRecursive, we should be able to callrecurse.headin a typesafe way, and passrecurse.head.grouptoRecursiveConsParser.We should then adjust
RecursiveConsParser.args, so that it prepends its group (if it has one) to each of theArgs it returns.Lastly, in
Help, we can then use theArg.groupof itsargsto 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