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. How to rewrite "Usage" on help of console app
Forum Updated to NodeBB v4.3 + New Features

How to rewrite "Usage" on help of console app

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 568 Views
  • 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.
  • K Offline
    K Offline
    Kien Bui
    wrote on last edited by
    #1

    I make a console app.
    I use CommandLineParse .
    When I call "./app -h"
    Usage: ./app [options] comnand
    Options:
    ........
    Arguments:
    command .......

    How to change the location of "[options]" to after command Or How to rewrite "Usage" Part

    jsulmJ 1 Reply Last reply
    0
    • K Kien Bui

      I make a console app.
      I use CommandLineParse .
      When I call "./app -h"
      Usage: ./app [options] comnand
      Options:
      ........
      Arguments:
      command .......

      How to change the location of "[options]" to after command Or How to rewrite "Usage" Part

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Kien-Bui said in How to rewrite "Usage" on help of console app:

      How to change the location of "[options]" to after command Or How to rewrite "Usage" Part

      What is the problem? It is your code, right? Then change it accordingly.
      I guess you have something like

      QString usage = "Usage: ./app [options] command";
      

      somewhere in your app. Then change it to

      QString usage = "Usage: ./app command [options]";
      

      Isn't that hard...
      Same for "Usage" part.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • K Offline
        K Offline
        Kien Bui
        wrote on last edited by Kien Bui
        #3

        It is generated automatically by QCommandLineParse

        jsulmJ 1 Reply Last reply
        0
        • K Kien Bui

          It is generated automatically by QCommandLineParse

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Kien-Bui I don't know what excatly you want to change in Usage part.
          See http://doc.qt.io/qt-5/qcommandlineparser.html
          I don't know whether you can move [options] behind command and I don't know why you actually want to do this. Usually you first pass options to an app and then the command, not other way around.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          K 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Kien-Bui I don't know what excatly you want to change in Usage part.
            See http://doc.qt.io/qt-5/qcommandlineparser.html
            I don't know whether you can move [options] behind command and I don't know why you actually want to do this. Usually you first pass options to an app and then the command, not other way around.

            K Offline
            K Offline
            Kien Bui
            wrote on last edited by Kien Bui
            #5

            @jsulm bz of simple, I don't like :)))
            Addition,
            I have many separate commands.
            Ex: ./app commandA [-op1 value1]...
            ./app commandB [-op2 value2]...
            ...
            How to design?

            1 Reply Last reply
            0

            • Login

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