mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-07 23:33:52 +00:00
Fix logic in example 'option_groups', documentation: fix escaped colon glyph (#692)
* Documentation: fixing escaped colon sign * Example option_groups: * fix output logic * add whitespace between format_type and string "format"
This commit is contained in:
parent
b65367a15a
commit
6b95ee8ab5
@ -2,7 +2,7 @@
|
||||
|
||||
## Simple options
|
||||
|
||||
The most versatile addition to a command line program is a option. This is like a flag, but it takes an argument. CLI11 handles all the details for many types of options for you, based on their type. To add an option:
|
||||
The most versatile addition to a command line program is an option. This is like a flag, but it takes an argument. CLI11 handles all the details for many types of options for you, based on their type. To add an option:
|
||||
|
||||
```cpp
|
||||
int int_option{0};
|
||||
@ -21,7 +21,7 @@ You can use any C++ int-like type, not just `int`. CLI11 understands the followi
|
||||
| Type | CLI11 |
|
||||
|-------------|-------|
|
||||
| number like | Integers, floats, bools, or any type that can be constructed from an integer or floating point number. Accepts common numerical strings like `0xFF` as well as octal, and decimal |
|
||||
| string-like | std\::string, or anything that can be constructed from or assigned a std\::string |
|
||||
| string-like | std::string, or anything that can be constructed from or assigned a std::string |
|
||||
| char | For a single char, single string values are accepted, otherwise longer strings are treated as integral values and a conversion is attempted |
|
||||
| complex-number | std::complex or any type which has a real(), and imag() operations available, will allow 1 or 2 string definitions like "1+2j" or two arguments "1","2" |
|
||||
| enumeration | any enum or enum class type is supported through conversion from the underlying type(typically int, though it can be specified otherwise) |
|
||||
|
@ -33,10 +33,10 @@ int main(int argc, char **argv) {
|
||||
CLI11_PARSE(app, argc, argv);
|
||||
|
||||
std::string format_type = (csv) ? std::string("CSV") : ((human) ? "human readable" : "binary");
|
||||
std::cout << "Selected " << format_type << "format" << std::endl;
|
||||
if(fileLoc.empty()) {
|
||||
std::cout << "Selected " << format_type << " format" << std::endl;
|
||||
if(!fileLoc.empty()) {
|
||||
std::cout << " sent to file " << fileLoc << std::endl;
|
||||
} else if(networkAddress.empty()) {
|
||||
} else if(!networkAddress.empty()) {
|
||||
std::cout << " sent over network to " << networkAddress << std::endl;
|
||||
} else {
|
||||
std::cout << " sent to std::cout" << std::endl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user