code cleanup
git-svn-id: https://svn.code.sf.net/p/porg/code/trunk@139 8854956c-c02d-4db9-8198-7e99b8e08f37
This commit is contained in:
parent
5b6ee45910
commit
87c3c337cb
19
porg/opt.cc
19
porg/opt.cc
|
@ -223,7 +223,8 @@ Opt::Opt(int argc, char* argv[])
|
|||
case OPT_EXACT_VERSION:
|
||||
check_mode(MODE_REMOVE, c);
|
||||
case OPT_ALL:
|
||||
check_mode(MODES_LIST | MODE_INFO | MODE_CONF_OPTS, c);
|
||||
check_mode(MODE_LIST_PKGS | MODE_LIST_FILES | MODE_INFO
|
||||
| MODE_CONF_OPTS, c);
|
||||
break;
|
||||
|
||||
case OPT_SORT:
|
||||
|
@ -231,7 +232,7 @@ Opt::Opt(int argc, char* argv[])
|
|||
case OPT_TOTAL:
|
||||
case OPT_NO_PACKAGE_NAME:
|
||||
case OPT_SIZE:
|
||||
check_mode(MODES_LIST, c);
|
||||
check_mode(MODE_LIST_PKGS | MODE_LIST_FILES, c);
|
||||
break;
|
||||
|
||||
case OPT_DATE:
|
||||
|
@ -357,20 +358,14 @@ void Opt::check_mode(int modes, char optchar)
|
|||
//
|
||||
void Opt::check_required(char optchar, string const& required)
|
||||
{
|
||||
assert(!required.empty());
|
||||
|
||||
if (s_optchars.find_first_of(required) == string::npos) {
|
||||
|
||||
string err = string("Option -") + optchar + " requires ";
|
||||
string err = string("Option -") + optchar + " requires";
|
||||
|
||||
if (required.size() > 1) {
|
||||
err += string("at least one of -");
|
||||
for (uint i = 0; i < required.size(); err += required[i++]) ;
|
||||
}
|
||||
else
|
||||
err += string("-") + required;
|
||||
if (required.size() > 1)
|
||||
err += " at least one of";
|
||||
|
||||
die_help(err);
|
||||
die_help(err + " -" + required);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,10 +29,6 @@ enum {
|
|||
MODE_REMOVE = 1 << 6
|
||||
};
|
||||
|
||||
enum {
|
||||
MODES_LIST = MODE_LIST_PKGS | MODE_LIST_FILES
|
||||
};
|
||||
|
||||
|
||||
class Opt : public BaseOpt
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue