From c51b8bbdee7d37c3305fa6bc373024c2e6f2250f Mon Sep 17 00:00:00 2001 From: Jarryd Beck Date: Thu, 25 Aug 2016 08:35:01 +1000 Subject: [PATCH] default and implicit options in readme This closes issue #20. --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 0736fde..098ab00 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,24 @@ To set up positional arguments, call where "last" should be the name of an option with a container type, and the others should have a single value. +## Default and implicit values + +An option can be declared with a default or an implicit value, or both. + +A default value is the value that an option takes when it is not specified +on the command line. The following specifies a default value for an option: + + cxxopts::value()->default_value("value") + +An implicit value is the value that an option takes when it is given on the +command line without an argument. The following specifies an implicit value: + + cxxopts::value()->implicit_value("implicit") + +If an option had both, then not specifying it would give the value `"value"`, +writing it on the command line as `--option` would give the value `"implicit"`, +and writing `--option=another` would give it the value `"another"`. + # Linking This is a header only library.