comonicon / Comonicon.jl

Your best CLI generator in JuliaLang
https://comonicon.org
MIT License
284 stars 25 forks source link

Feature request: Support options without default values #195

Closed GiggleLiu closed 2 years ago

GiggleLiu commented 2 years ago

Nice repo! I am trying to create an application, in which it is unsafe to make either the argument name a positional argument, or a keyword argument having a default value.

@cast function generate_smallgraph(problem::String;
    name::String,
    weights::Union{Nothing,Vector{Float64}}=nothing,
    datafolder::String="data", prefix::String="")
    graph = SmallGraphConfig(name)
    config = GraphProblemConfig(; problem, graph, weights, openvertices=Int[])
    foldername(datafolder, config; create=true, prefix)
end

The error message is

shell> julia --project project/run.jl generate-smallgraph IndependentSet --name=petersen
ERROR: LoadError: options should have default values or make it a positional argument

I wish it can be supported!