Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. macOS QCommandLineParser missing --help/--version output
Forum Updated to NodeBB v4.3 + New Features

macOS QCommandLineParser missing --help/--version output

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 290 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SandyLocke
    wrote on 29 Jul 2019, 13:23 last edited by
    #1

    On a macOS (10.14.6) terminal an app bundle can be executed like open mytool.app --args --input some.txt or open mytool.app --args --help. The first one is a custom argument and works perfectly fine but the second on is a trouble maker. In the case of open mytool.app --args --help the app gets properly executed but there is now output in the terminal. My expectation was to see similar output like on the other platforms (Linux, Windows). The implemenation is always the same, which uses QCommandLineParser::showHelp() and QCommandLineParser::showVersion() and on Linux/Windows the code produces text like shown below.

    Usage: mytool.app [options] [files]
    
    Options:
      -h, --help          Displays this help.
      -v, --version     Displays version information.
      --input               Some stuff
    
    Arguments:
      files              List of files to be opened.
    

    Because the code is working well on Linux and Windows I think it is a macOS specific issue. Is my expectation wrong? Do you have a hint what causes the problem?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 29 Jul 2019, 19:45 last edited by
      #2

      Hi,

      For the help part, I would rather call the executable from the bundle directly rather than calling open. Note that I might be old fashioned with regard to that.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply 30 Jul 2019, 09:17
      1
      • S SGaist
        29 Jul 2019, 19:45

        Hi,

        For the help part, I would rather call the executable from the bundle directly rather than calling open. Note that I might be old fashioned with regard to that.

        S Offline
        S Offline
        SandyLocke
        wrote on 30 Jul 2019, 09:17 last edited by
        #3

        Hi @sgaist, your suggestion is the way to go. I just learned that open does not start a sub-process. Instead a message is send to the OS launch system, which then executes the app. If Finder is used to run the app the same approach is used.

        1 Reply Last reply
        2

        1/3

        29 Jul 2019, 13:23

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved