From 51dc9396d8bd8f0971a59f4e3aa11e8315c394cd Mon Sep 17 00:00:00 2001
From: Boris Kolpackov #
are ignored. The semantics
- of providing options in a file is equivalent to providing the same set
- of options in the same order on the command line at the point where the
- options file is specified, except that shell escaping and quoting is not
- required. Multiple files can be specified by including several file
- options on the command line or inside other files.
#
are ignored. Option values can
+ be enclosed in double quotes (" "
) to preserve leading
+ and trailing whitespaces as well as to specify empty values. If the
+ value itself contains trailing or leading double quote, enclose
+ it into an extra pair of double quotes, for example ""x""
.
+ Non-leading and non-trailing quotes are interpreted as being part of
+ the option value.
+
+ The semantics of providing options in a file is equivalent to providing + the same set of options in the same order on the command line at the + point where the options file is specified, except that shell escaping + and quoting is not required. Multiple files can be specified by including + several file options on the command line or inside other files.
The parsing constructor (those with the argc/argv
or
cli::scanner
arguments) can throw the following exceptions: cli::unknown_option
,
@@ -774,7 +781,9 @@ namespace cli
error in an option parser implementation. The argv_file_scanner
class can also throw the cli::file_io_failure
exception
which indicates that a file could not be opened or there was a reading
- error.
cli::unmatched_quote
exception
+ which indicates that an unmatched leading or trailing quote was
+ found in an option value.
All CLI exceptions are derived from the common cli::exception
class which implements the polymorphic std::ostream
insertion.
@@ -893,6 +902,21 @@ namespace cli
virtual const char*
what () const throw ();
};
+
+ class unmatched_quote: public exception
+ {
+ public:
+ unmatched_quote (const std::string& argument);
+
+ const std::string&
+ argument () const;
+
+ virtual void
+ print (std::ostream&) const;
+
+ virtual const char*
+ what () const throw ();
+ };
}
--
cgit v1.1