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

qcommandlineoption required flag

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P2: Important
    • None
    • None
    • Core: I/O
    • None

    Description

      When using qcommandlineparser, there is no way to tell that one option is mandatory, one has to do it by hand later on.

      It would be more convenient if one could use a flag in the qcommandlineoption to mark it as 'required', so that the parser automatically detects if this was passed as CLI argument and prompts the error message.

      So to say, something like:

      parser.addOption({"f","file","The input file","", true})

      and for backward compatibility this last boolean can be set as false as default value.

      Also, it could be nice if one could also specify the expected data type of associated values, e.g. "int", "string" or "double" when defining the QCommandlineoption, so that the returned QVariant gets automatically casted to it and you can retrieve it with an 'auto' variable.

      parser.addOption({"f","file","The input file","", true, "QString"})

      Attachments

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

        Activity

          People

            dfaure_kdab David Faure
            fmercury Ferdy Mercury
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes