szaghi / FLAP

Fortran command Line Arguments Parser for poor people
150 stars 34 forks source link

Add CLA sectioning for better help message of long list of CLAs #74

Open szaghi opened 7 years ago

szaghi commented 7 years ago

For CLI having a long list of CLAs it could be helpful to section CLAs in families of CLAs, e.g. files-section, dirs-section, input-section...

Something similar to argparse groups that is different from FLAP groups that are, indeed, argparse subcommands.

Example

type(command_line_interface) :: cli

call cli%init
call cli%add(switch='--grid_file', &
             switch_ab='-g',    &
             help='Grid file name',   &
             required=.true.,   &
             act='store',       &
             section='files', &
             error=error)
call cli%add(switch='--sol_file', &
             switch_ab='-s',    &
             help='Solution file name',   &
             required=.true.,   &
             act='store',       &
             section='files', &
             error=error)
call cli%add(switch='--sim_dir', &
             switch_ab='-g',    &
             help='Simulation directory path',   &
             required=.true.,   &
             act='store',       &
             section='directories', &
             error=error)

That should generate something like

usage...

files:
  --grid_file Grid file
...
directories
  --sim_dir Simulation directory path