Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support option type #222

Merged
merged 4 commits into from
Aug 22, 2022
Merged

support option type #222

merged 4 commits into from
Aug 22, 2022

Conversation

Roger-luo
Copy link
Collaborator

This implements the following dot syntax for long options when the corresponding type
is an option type defined by Configurations, e.g

using Test
using Comonicon
using Configurations

@option struct OptionA
    a::Int
    b::Int
end

@option struct OptionB
    option::OptionA
    c::Int
end

"""
# Options

- `-c, --config <path/to/option/or/specific field>`: config.
"""
@main function run(;config::OptionB)
    @test config == OptionB(OptionA(1, 1), 1)
end

can be used with the following syntax

command --config.c=1 --config.option.a=1 --config.option.b=1
command --config=config.toml
command -c config.toml

@codecov
Copy link

codecov bot commented Aug 21, 2022

Codecov Report

Base: 83.24% // Head: 83.65% // Increases project coverage by +0.41% 🎉

Coverage data is based on head (9d2ea81) compared to base (ba45d81).
Patch coverage: 88.88% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #222      +/-   ##
==========================================
+ Coverage   83.24%   83.65%   +0.41%     
==========================================
  Files          21       21              
  Lines        1540     1585      +45     
==========================================
+ Hits         1282     1326      +44     
- Misses        258      259       +1     
Impacted Files Coverage Δ
src/codegen/julia.jl 88.85% <88.88%> (+1.49%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant