Hi,
I am trying to use ArgParse to read options from command line. It works when I have three options, but when I add another option it throws “too many argument” error. I appreciate your help.
using ArgParse
function parse_commandline()
s = ArgParseSettings()
@add_arg_table s begin
"--opt1"
"--opt2"
"--opt3"
"--opt4"
end
return parse_args(s)
end
parsed_args = parse_commandline()
ERROR: LoadError: ArgParseError("too many arguments")
Stacktrace:
[1] argparse_error(x::Any)
@ ArgParse ~/.julia/packages/ArgParse/bylyV/src/parsing.jl:9
[2] parse_arg!(state::ArgParse.ParserState, settings::ArgParseSettings)
@ ArgParse ~/.julia/packages/ArgParse/bylyV/src/parsing.jl:918
[3] parse_args_unhandled(args_list::Vector{T} where T, settings::ArgParseSettings, truncated_shopts::Bool)
@ ArgParse ~/.julia/packages/ArgParse/bylyV/src/parsing.jl:632
[4] parse_args_unhandled(args_list::Vector{T} where T, settings::ArgParseSettings)
@ ArgParse ~/.julia/packages/ArgParse/bylyV/src/parsing.jl:595
[5] parse_args(args_list::Vector{T} where T, settings::ArgParseSettings; as_symbols::Bool)
@ ArgParse ~/.julia/packages/ArgParse/bylyV/src/parsing.jl:469
[6] parse_args(args_list::Vector{T} where T, settings::ArgParseSettings)
@ ArgParse ~/.julia/packages/ArgParse/bylyV/src/parsing.jl:466
[7] parse_args(settings::ArgParseSettings; kw::Any)
@ ArgParse ~/.julia/packages/ArgParse/bylyV/src/parsing.jl:421
[8] parse_args(settings::ArgParseSettings)
@ ArgParse ~/.julia/packages/ArgParse/bylyV/src/parsing.jl:421
[9] parse_commandline()
@ Main ~/Documents/repositories/local/using ArgParse.jl:10
[10] top-level scope