Improve command line
[lgpl/argeo-commons.git] / org.argeo.api.cli / src / org / argeo / api / cli / DescribedCommand.java
index 7a9d5d90111ece240c66576b51d5f5613776f7d1..51cb2cecaa2558698d63a30d89d7a479fbda71a6 100644 (file)
@@ -41,6 +41,11 @@ public interface DescribedCommand<T> extends Function<List<String>, T> {
                        Object output = command.apply(Arrays.asList(args));
                        System.out.println(output);
                        System.exit(0);
+               } catch (PrintHelpRequestException e) {
+                       StringWriter out = new StringWriter();
+                       HelpCommand.printHelp(command, out);
+                       System.out.println(out.toString());
+                       System.exit(1);
                } catch (IllegalArgumentException e) {
                        StringWriter out = new StringWriter();
                        HelpCommand.printHelp(command, out);