Closed n-peugnet closed 4 years ago
Bon finalement j'ai utilisé picocli c'est bien stylé. Ya un peu de conf à faire mais ensuite ça se résume à ça :
@Option(names = { "--np" }, paramLabel = "<number>", description = "Number of processus in the network", showDefaultValue = Visibility.ALWAYS)
static int nbProcs = 5;
@Option(names = { "-s", "--scenario" }, paramLabel = "<path>", description = "Path to the scenario file")
static File scenario = null;
@Parameters(paramLabel = "<process-class>", description = "Fully qualified name of the class to use as process", index = "0")
static String pClassName;
@Parameters(paramLabel = "<runner-class>", description = "Fully qualified name of the class to use as runner", index = "1")
static String rClassName;
@Parameters(paramLabel = "<args>", arity = "0..*", description = "Args to pass to the processes", index = "2..*")
static String[] args = new String[0];
@Option(names = { "-h", "--help" }, usageHelp = true, description = "display a help message")
protected boolean help = false;
Pour ça j'ai prévu d'utiliser Apache.Commons.CLI pour rendre les parametres np et scenario optionnel.
Ce qui donnera une usage string de ce type