mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-04-30 04:33:53 +00:00
Futher improvement for #12, can change type str
This commit is contained in:
parent
04268dac5a
commit
e3423bb5ad
@ -433,6 +433,10 @@ class Option {
|
||||
/// Set the default value string representation
|
||||
void set_default_val(std::string val) { defaultval_ = val; }
|
||||
|
||||
|
||||
/// Set the type name displayed on this option
|
||||
void set_type_name(std::string val) {typeval_ = val;}
|
||||
|
||||
///@}
|
||||
|
||||
protected:
|
||||
|
@ -190,6 +190,22 @@ TEST(THelp, ExcludesPositional) {
|
||||
EXPECT_THAT(help, HasSubstr("Excludes: op1"));
|
||||
}
|
||||
|
||||
TEST(THelp, ManualSetters) {
|
||||
|
||||
CLI::App app{"My prog"};
|
||||
|
||||
int x;
|
||||
|
||||
CLI::Option *op1 = app.add_option("--op", x);
|
||||
op1->set_default_val("12");
|
||||
op1->set_type_name("BIGGLES");
|
||||
|
||||
std::string help = app.help();
|
||||
|
||||
EXPECT_THAT(help, HasSubstr("=12"));
|
||||
EXPECT_THAT(help, HasSubstr("BIGGLES"));
|
||||
}
|
||||
|
||||
TEST(THelp, Subcom) {
|
||||
CLI::App app{"My prog"};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user