From boris at codesynthesis.com Thu Dec 1 07:49:15 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Dec 1 07:57:13 2011 Subject: [cli-users] unset option In-Reply-To: References: Message-ID: Hi Philipp, Philipp Eichmann writes: > std::string -d | --directory { > "", > "bla" > }; > > std::string -z { > "", > "blu" > }; > > If I launch the application with "./myapp -d -z test" and print option > -d with options.d(), I get the string "-z" as result. > Which is obivously wrong since -d should not be set or empty. CLI supports two types of options: those that have a value and those that don't (called flags). In particular, ODB does not support options that may or may not have a value. To define a flag, use bool as the option type: bool -z { "do zzz" }; std::string -d { "" "specify directory" }; With the above option specification, you can do: ./myapp -z -d foo ./myapp -d foo -z Boris