I have a TreeCompleter (Scala code) which works as expected:
val treeCompleter = new TreeCompleter(
node("bindkey"),
node("cls"),
node(
"custom",
node("Option1", node("Param1", "Param2")),
node("Option2"),
node("Option3")
),
node("help"),
node("set"),
node("testkey"),
node("tput")
)
How can I obtain the collection of command names? For this example, those names are: bindkey, cls, custom, help, set, testkey and tput.
The github project that contains the above code is here: https://github.com/mslinn/jline-example/blob/master/src/main/scala/CliLoop.scala
I don't care if the answer is in Java or Scala, thanks!
I don't think it is possible this way given that
TreeCompleteris just a wrapper aroundRegexCompleterthat actually does the job. So if you want to gather this information, you should do it before you pass your nodes to theTreeCompleterconstructor or probably before you createTreeCompleter.Nodeinstances because they seem to provide no public accessors. One obvious solution would be to create your own wrapper aroundTreeCompleterwith your own innerNodeclass that would store this information for later usage.