Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved help #97

Closed
wants to merge 3 commits into from
Closed

Improved help #97

wants to merge 3 commits into from

Conversation

adamkaliszan
Copy link

@adamkaliszan adamkaliszan commented Nov 26, 2024

Indents that provide better readability

Before changes Exemplary output ( Lyra/examples/doc_commands.cpp)

adam@PiaskunGTR:~/github/Lyra/examples$ ./develop_doc_commands -h
USAGE:
  develop_doc_commands [-?|-h|--help] [ kill [-?|-h|--help] [-s|--signal <signal>] <process_name> ] [ run [-?|-h|--help] [-v|--verbose] <command> [<command>...] ]

Display usage information.

OPTIONS, ARGUMENTS:
  -?, -h, --help          
                          
  kill                    Terminate the process with the given name.
                          
  -?, -h, --help          
  -s, --signal <signal>   The signal integer to post to the running process. [default: 9]
  <process_name>          The name of the process to search and signal.
                          
  run                     Execute the given command.
                          
  -?, -h, --help          
  -v, --verbose           Show additional output as to what we are doing.
  <command> [<command>...]
                          The command, and arguments, to attempt to run.

After changes:

adam@PiaskunGTR:~/github/Lyra/examples$ ./doc_commands -h
USAGE:
  doc_commands [-?|-h|--help] [ kill [-?|-h|--help] [-s|--signal <signal>] <process_name> ] [ run [-?|-h|--help] [-v|--verbose] <command> [<command>...] ]

Display usage information.

OPTIONS, ARGUMENTS:
    -?, -h, --help        
                          
      kill        Terminate the process with the given name.
                          
        -?, -h, --help    
        -s, --signal <signal>
                          The signal integer to post to the running process. [default: 9]
        <process_name>    The name of the process to search and signal.
                          
      run         Execute the given command.
                          
        -?, -h, --help    
        -v, --verbose     Show additional output as to what we are doing.
        <command> [<command>...]
                          The command, and arguments, to attempt to run.

Help output in mu project with nested subcommands (3 levels)

GaiaClient -h
USAGE:
  GaiaClient [-?|-h|--help] [ send [-?|-h|--help] [ param [-I|--id <ParamID>] [-V|--value <Value>] ] [ config [-V|--value <Value>] ] [ ant_mode [ TLE [-s|--satName <Satelite name>] [-f|--fileName <File name>] ] [ park  ] [ standby  ] ] ] [ show [-?|-h|--help] [ param [-I|--id <ParamID>] [-V|--value <Value>] ] [ config [-V|--value <Value>] ] [ ant_mode [ TLE [-s|--satName <Satelite name>] [-f|--fileName <File name>] ] [ park  ] [ standby  ] ] ] [ curl [-?|-h|--help] [ param [-I|--id <ParamID>] [-V|--value <Value>] ] [ config [-V|--value <Value>] ] [ ant_mode [ TLE [-s|--satName <Satelite name>] [-f|--fileName <File name>] ] [ park  ] [ standby  ] ] ] [ save [-a|--address <Gaia daemon address>] [-p|--gaia_port <Gaia daemon port>] ] [ connect  ] [ disconnect  ] [ logger [-f|--loop <EnlessLoop>] ]

Display usage information.

OPTIONS, ARGUMENTS:
  -?, -h, --help          
                          
    send          Send command to Gaia Daemon.
                          
      -?, -h, --help      
                          
        param     Send param command
                          
          -I, --id <ParamID>
                          Param id 0-5
          -V, --value <Value>
                          Param value
                          
        config    Send Anthena Config command
                          
          -V, --value <Value>
                          Param value
                          
        ant_mode  Anthena Mode El Az Tl
                          
                          
            TLE   
                          
              -s, --satName <Satelite name>
                          Satelite name
              -f, --fileName <File name>
                          File name with TLE data
                          
            park  
                          
                          
            standby
                          
                          
                          
    show          Show json messages.
                          
      -?, -h, --help      
                          
        param     Send param command
                          
          -I, --id <ParamID>
                          Param id 0-5
          -V, --value <Value>
                          Param value
                          
        config    Send Anthena Config command
                          
          -V, --value <Value>
                          Param value
                          
        ant_mode  Anthena Mode El Az Tl
                          
                          
            TLE   
                          
              -s, --satName <Satelite name>
                          Satelite name
              -f, --fileName <File name>
                          File name with TLE data
                          
            park  
                          
                          
            standby
                          
                          
                          
    curl          Show curl command.
                          
      -?, -h, --help      
                          
        param     Send param command
                          
          -I, --id <ParamID>
                          Param id 0-5
          -V, --value <Value>
                          Param value
                          
        config    Send Anthena Config command
                          
          -V, --value <Value>
                          Param value
                          
        ant_mode  Anthena Mode El Az Tl
                          
                          
            TLE   
                          
              -s, --satName <Satelite name>
                          Satelite name
              -f, --fileName <File name>
                          File name with TLE data
                          
            park  
                          
                          
            standby
                          
                          
                          
    save          Save given in args param to local settings.
                          
      -a, --address <Gaia daemon address>
                          Remote ACU IP address
      -p, --gaia_port <Gaia daemon port>
                          REST Port for Gaia daemon
                          
    connect       Start connection between gaiaDaemon and Gaia.
                          
                          
    disconnect    Close connection between gaiaDaemon and Gaia.
                          
                          
    logger        Show the Gaia state.
                          
      -f, --loop <EnlessLoop>
                          Persistant checking status

Without this PR help in my project was unreadable and seams that some commands ware duplicated. In Fact there is Cartesian product of (send, show, curl) and (param, config, ant_mode). Moreover ant_mode contains 3. level of subcommands.

@adamkaliszan adamkaliszan force-pushed the help branch 5 times, most recently from eff6c62 to 2cdfac4 Compare December 3, 2024 17:44
@grafikrobot
Copy link
Member

Thank you for the contribution. Two requests/questions..

  1. Could you provide a before and after output so I can see what the effect of your changes are?
  2. Can you rename the ident parameter to indent?

@adamkaliszan
Copy link
Author

Thank you for the contribution. Two requests/questions..

  1. Could you provide a before and after output so I can see what the effect of your changes are?
  2. Can you rename the ident parameter to indent?

Thx for Your remarks. It is done. An exemplary output is presented in PR description.

Indents that provide better readability
@adamkaliszan
Copy link
Author

The indents for arguments are fixed.

@grafikrobot
Copy link
Member

FYI. Thanks for the changes. I decided to use your changes as inspiration and rework he way formatting is done to make this more flexible and customizable per parser. If the new way is not enough of an improvement please open an issue and I'll work to make it better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants