From 6b95ee8ab55851cc5f5b52e0c3e419bccc620e36 Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Fri, 24 Dec 2021 21:29:46 +0100 Subject: [PATCH] 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" --- book/chapters/options.md | 4 ++-- examples/option_groups.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/book/chapters/options.md b/book/chapters/options.md index 8b1daa0f..77c41664 100644 --- a/book/chapters/options.md +++ b/book/chapters/options.md @@ -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) | diff --git a/examples/option_groups.cpp b/examples/option_groups.cpp index acc65740..214e2026 100644 --- a/examples/option_groups.cpp +++ b/examples/option_groups.cpp @@ -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;