How to print picocli usage before every execution

52 views Asked by At

Is there a way to show picocli usage everytime even if the mandatory options/parameters requirements are fulfilled, either through some inbuilt option or custom configuration. I would wish for an inbuilt option property sth like "default" to configure behavior to show always.

As per my experience/understanding it only shows the usage when either no/incomplete/incorrect option/parameters is provided or whther the user explictly chooses to show usage help via '-h' or '--help'

I'm using a plain groovy script. No classes in there.

1

There are 1 answers

0
Remko Popma On BEST ANSWER

You can invoke the CommandLine.usage(PrintStream) method from your script.

In your script, try adding this line:

// the CommandLine that parsed the args is available as a property
this.commandLine.usage(System.out)

// remainder of script