]> git.tdb.fi Git - libs/core.git/commitdiff
Cosmetic fixes for comments and output
authorMikko Rasa <tdb@tdb.fi>
Fri, 3 May 2013 09:47:24 +0000 (12:47 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 3 May 2013 09:47:24 +0000 (12:47 +0300)
source/core/getopt.cpp
source/core/getopt.h

index 2561c9a3e51f0acfc5bca50c099a2a8d1a3cce53..e42ceb2143fb28265277c534af6c536878f16a03 100644 (file)
@@ -141,7 +141,7 @@ void GetOpt::operator()(unsigned argc, const char *const *argv)
        }
 
        if(help)
        }
 
        if(help)
-               throw usage_error(string("Help for ")+argv[0]+":", generate_help());
+               throw usage_error(string("Help for ")+argv[0]+":", "\nUsage:\n  "+generate_usage(argv[0])+"\n\n"+generate_help());
 }
 
 unsigned GetOpt::process_long(const char *const *argp)
 }
 
 unsigned GetOpt::process_long(const char *const *argp)
index f4e318e55d3eec1e8b14a160101e75c7be9e9cbb..411515f5dd9c1d837e47131ca3c2ee1d08f21e91 100644 (file)
@@ -33,12 +33,12 @@ the string "-abc" could be interpreted as having the options 'a', 'b' and 'c'.
 If the option takes an argument and there are unused characters in the argv
 element, then those characters are interpreted as the argument.  Otherwise the
 next element is taken as the argument.  An optional argument must be given in
 If the option takes an argument and there are unused characters in the argv
 element, then those characters are interpreted as the argument.  Otherwise the
 next element is taken as the argument.  An optional argument must be given in
-the same element.
+the same element if it is given.
 
 Long options begin with a double dash and are identified by an arbitrary
 string.  An argument can be specified either in the same argv element,
 separated by an equals sign, or in the next element.  As with short options,
 
 Long options begin with a double dash and are identified by an arbitrary
 string.  An argument can be specified either in the same argv element,
 separated by an equals sign, or in the next element.  As with short options,
-an optional argument must be in the same element.
+an optional argument, if given, must be in the same element.
 
 A single option may have both alternative forms, but must always have at least
 a long form.  This is to encourage self-documenting options; it's much easier
 
 A single option may have both alternative forms, but must always have at least
 a long form.  This is to encourage self-documenting options; it's much easier
@@ -220,9 +220,9 @@ public:
 
        /** Adds an option with both short and long forms.  Processing depends on
        the type of the destination variable and whether an argument is taken or
 
        /** Adds an option with both short and long forms.  Processing depends on
        the type of the destination variable and whether an argument is taken or
-       not.  With an argument, the value is lexical_cast to appropriate type and
-       stored in the destination.  Without an argument, a bool will be set to true
-       and an unsigned will be incremented; any other type will be ignored. */
+       not.  With an argument, the value is lexical_cast to the appropriate type
+       and stored in the destination.  Without an argument, a bool will be set to
+       true and an unsigned will be incremented; any other type will be ignored. */
        template<typename T>
        Option &add_option(char s, const std::string &l, T &d, ArgType a = NO_ARG)
        { return add_option(s, l, SimpleStore<T>(d), a); }
        template<typename T>
        Option &add_option(char s, const std::string &l, T &d, ArgType a = NO_ARG)
        { return add_option(s, l, SimpleStore<T>(d), a); }