# ohcli **Repository Path**: cmvy2020/ohcli ## Basic Information - **Project Name**: ohcli - **Description**: A single-header command line argument parser. - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-12-03 - **Last Updated**: 2022-12-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ohcli [![License](https://img.shields.io/github/license/caozhanhao/ohcli?label=License&style=flat-square)](LICENSE) ![](https://img.shields.io/github/v/release/caozhanhao/ohcli?label=Release&style=flat-square) # example ```c++ #include "ohcli.h" #include int main(int argc, char **argv) { ohcli::CLI cli; double range = 0; int oneof = 0; bool option = false; std::string regex; cli.add_value("s", regex, ohcli::email()); //or cli.add_value("s", regex, ohcli::regex("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$")); cli.add_value("r", range, ohcli::range(0.0, 1.0)); cli.add_value("f", "oneof", oneof, ohcli::oneof({1, 3, 5})); //or cli.add_value("f", "oneof", oneof, ohcli::oneof({1,3,5})); cli.add_option("o", "option", option); cli.add_cmd("p", "print", [](ohcli::CmdArg &args) { std::cout << "print: "; for (auto &r: args) std::cout << "\"" << r << "\" "; std::cout << std::endl; }); cli.parse(argc, argv); cli.run(); return 0; } ```