seqan / product_backlog

This repository is used as product backlog for all SeqAn relevant backlog items. This is intended to organise the work for the team.
2 stars 1 forks source link

Overwrite default in argument parser #401

Closed eseiler closed 2 years ago

eseiler commented 2 years ago
// uint8_t kmer_size{20u};
// uint32_t window_size{kmer_size};
parser.add_option(arguments.window_size,
                  '\0',
                  "window",
                  "The window size.");

Will set The window size. Default: 20 as help page message. It would be nice to overwrite the default-part and say something like Default: k-mer size.

It's currently hardcoded: https://github.com/seqan/seqan3/blob/34f3a7f672b6228d5ae1036d2ff590b244cb098e/include/seqan3/argument_parser/detail/format_base.hpp#L240

template <typename option_type, typename validator_type>
void add_option(option_type & value,
                char const short_id,
                std::string const & long_id,
                std::string const & desc,
                option_spec const spec,
                validator_type && option_validator)
{
    std::string id = prep_id_for_help(short_id, long_id) + " " + option_type_and_list_info(value);
    std::string info{desc};
    info += ((spec & option_spec::required) ? std::string{" "} : detail::to_string(" Default: ", value, ". "));
    info += option_validator.get_help_page_message();
    store_help_page_element([this, id, info] () { derived_t().print_list_item(id, info); }, spec);
}
smehringer commented 2 years ago

The only thing why we did not do that yet, is that the add_option call has already a lot of parameters, so the easy fix of adding another one seems not the best approach.

smehringer commented 2 years ago

Duplicate of external user request: seqan/sharg-parser#76

smehringer commented 2 years ago

closed because of duplicate