Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-100321

QCommandLineParser::process() and parse() incorrect behavior

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.15.2, 6.2.3
    • Core: Other
    • None
    • All

      When running the attached sample program, if only one single argument: "-x" or "-y" is provided without value, the parser reports correctly an error, and exists with exit code 1

      Run with arguments: -x
      Output:
      Missing value after '-x'.

      But if both arguments are provided without values: "-x -y", then no error is reported, and the second option name is parsed as the first argument value, ending with exit code 0.

      Run with arguments: -x -y 3
      Output:
      {{parsed options: QList("x")
      unknown options: QList()
      positional arguments: QList("3")}}

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            thiago Thiago Macieira
            plcl Pedro López-Cabanillas
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes