添加生成help功能
This commit is contained in:
@@ -97,3 +97,15 @@ TEST(Option, 匿名参数测试3) {
|
||||
if (order.analysis())
|
||||
ASSERT_FALSE("匿名参数数量超出限制,但是没有抛出异常!");
|
||||
}
|
||||
|
||||
|
||||
TEST(Option, Help生成) {
|
||||
ling::Order order({"-pts", "hello world!", "hello!", "--all", "--ok", "world"});
|
||||
order.addAnonymity(1);
|
||||
const auto pts = order.addOption({"-pts", "--pts"}, ling::Order::Type::STRING, "测试参数");
|
||||
const auto all = order.addOption({"-all", "--all"},"测试参数");
|
||||
const auto ok = order.addOption({"-ok", "--ok"},"测试参数");
|
||||
const auto cancel = order.addOption({"--cancel"},"测试参数");
|
||||
auto help = order.generateHelp("test [选项] .. [参数]\n测试命令");
|
||||
std::cout << help << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user