Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8578

Add errorWriter property to commons-cli CliBuilder

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      This ticket proposes to modify the commons-cli version of CliBuilder, so that it also has an errorWriter property that works similar to the picocli version of CliBuilder.

      Description of Functionality

      The picocli version of CliBuilder has an errorWriter property (System.err by default) that is used to print the error message and usage help to when the user provided invalid input on the command line. This prevents error messages from inadvertently being parsed by another program when the output of a groovy program is piped to another program.

      The previously existing writer property is used when the user requests help with -help or -version. This allows users to pipe the output of the help request to less or grep or another utility.

      Motivation

      • This is a good feature in general (follow conventions for command line applications)
      • It makes the commons-cli version and the picocli version of CliBuilder more consistent with each other.

      I can raise a PR if there is interest.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rpopma Remko Popma
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: