carlobaldassi/ArgParse.jl

Required argument listed as optional in arg table for command

Closed this issue · 1 comments

julia> using ArgParse

julia> settings = ArgParseSettings();

julia> @add_arg_table! settings begin
           "cmd"
           action = :command
       end;

julia> @add_arg_table! settings["cmd"] begin
           "--opt1"
           required = true

           "--opt2"
           required = false
       end;

julia> parse_args(["cmd", "-h"], settings)
usage: <PROGRAM> cmd --opt1 OPT1 [--opt2 OPT2] [-h]

optional arguments:
  --opt1 OPT1
  --opt2 OPT2
  -h, --help   show this help message and exit

This is not limited to commands; the issue is actually a duplicate of #108