szaghi / FLAP

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

Add group inheritance #76

Open giacrossi opened 7 years ago

giacrossi commented 7 years ago

Add group inheritance prevent duplicating CLAs: for example now we have to do

call cli%add_group(group='reconstruct', description='perform WENO reconstruction')
call cli%add(group='reconstruct', switch='--interpolator', switch_ab='-i', help='WENO interpolator type', required=.false., &
                   def='JS', act='store', choices='all,JS,M-JS,M-Z,Z') 
call cli%add_group(group='interpolate', description='perform WENO interpolation')
call cli%add(group= 'interpolate', switch='--interpolator', switch_ab='-i', help='WENO interpolator type', required=.false., &
                   def='JS', act='store', choices='all,JS,M-JS,M-Z,Z')
call cli%add(group='interpolate', switch='--x_target', switch_ab='-x', help='WENO interpolation target point coordinate', &
                   required=.true., def='0', act='store')

but with group inheritance, the syntax could be less repetitive, as:

call cli%add_group(group='reconstruct', description='perform WENO reconstruction')
call cli%add(group='reconstruct', switch='--interpolator', switch_ab='-i', help='WENO interpolator type', required=.false., &
                   def='JS', act='store', choices='all,JS,M-JS,M-Z,Z')
call cli%add_group(group='interpolate', description='perform WENO interpolation', inherit_group='reconstruct')
call cli%add(group='interpolate', switch='--x_target', switch_ab='-x', help='WENO interpolation target point coordinate', &
                   required=.true., def='0', act='store')