-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
Is there a way to parse arguments in a way that the group that they belong to is preserved? For example, considering the MWE below:
using ArgParse
settings = ArgParseSettings()
# Create argument groups using add_arg_group! function
add_arg_group!(settings, "Input Options", :input_group)
@add_arg_table! settings begin
"--input"
arg_type = String
"--format"
default = "csv"
end
add_arg_group!(settings, "Output Options", :output_group)
@add_arg_table! settings begin
"--output"
arg_type = String
"--verbose"
action = :store_true
end
args = parse_args(settings)
I'd like args
to return a hierarchical Dict, such as
julia> Dict(:input_group => Dict("input" => nothing, "format" => "csv"), :output_group => Dict("output" => nothing, "verbose" => false))
Dict{Symbol, Dict{String}} with 2 entries:
:input_group => Dict{String, Union{Nothing, String}}("format"=>"csv", "input"=>nothing)
:output_group => Dict{String, Union{Nothing, Bool}}("output"=>nothing, "verbose"=>false)
In this possible?
Metadata
Metadata
Assignees
Labels
No labels