Closed FRosner closed 8 years ago
Tried with https://github.com/FRosner/repl-helper/commit/f8d853048495a470de6c1e0c0d197b11eaca95c3 and it works. However, when requesting help for the first time, it takes several seconds to scan all the classes. So we might want to include a filter or something...
Why not compile help statically (scripted during the build, for example)? There's no obvious reason help has to do anything at runtime except to map a query to help text.
The reason is that I want users to be able to provide their own functions and servers and DDS should recognize these annotations as well. Does it make sense?
https://github.com/FRosner/repl-helper/releases/tag/1.1.0 released now which contains a method that takes a URL and scans all classes compiled there. I don't know if it will work with arbitrary server implementations at the moment but it allows me to get help from the web-ui as well as the core, although the core project does not depend on the web-ui one.
As long as we don't announce that as a feature, we have time to test it :P And if it works - we're good. If it doesn't we make it work.
private val helper = Helper(ClasspathHelper.forClass(this.getClass))
Now we run into another problem...
0 = {Tuple2@7322} "(public static void de.frosner.dds.core.DDS.help(),@de.frosner.replhelper.Help(parameters2=, parameters3=, parameters4=, parameters5=, parameters6=, parameters=, parameters7=, parameters8=, parameters9=, category=Help, shortDescription=Shows available commands, longDescription=Shows all commands available in DDS.))"
1 = {Tuple2@7323} "(public void de.frosner.dds.core.DDS$.help(),@de.frosner.replhelper.Help(parameters2=, parameters3=, parameters4=, parameters5=, parameters6=, parameters=, parameters7=, parameters8=, parameters9=, category=Help, shortDescription=Shows available commands, longDescription=Shows all commands available in DDS.))"
2 = {Tuple2@7324} "(public static void de.frosner.dds.core.DDS.help(java.lang.String),@de.frosner.replhelper.Help(parameters2=, parameters3=, parameters4=, parameters5=, parameters6=, parameters=commandName: String, parameters7=, parameters8=, parameters9=, category=Help, shortDescription=Explains given command, longDescription=Explains the given command.))"
3 = {Tuple2@7325} "(public void de.frosner.dds.core.DDS$.help(java.lang.String),@de.frosner.replhelper.Help(parameters2=, parameters3=, parameters4=, parameters5=, parameters6=, parameters=commandName: String, parameters7=, parameters8=, parameters9=, category=Help, shortDescription=Explains given command, longDescription=Explains the given command.))"
So a singleton object is compiled into static methods and a class with instance methods, both having the same method names and parameters.
Currently, help about start and stop methods is only printed when
help
is called after the web UI has already been started. This might not be very useful, because you need to know the start command beforehand.This is the case because the server helper is registered once a server is registered. Maybe we should scan the whole classpath for
@Help
annotation rather than explicitly requiring classes. Or at least the imported classes, if this is possible.Requires: https://github.com/FRosner/repl-helper/issues/8