kdb: refactor check
@@ -34,9 +34,7 @@ int printProblems (Key const & k, std::string const & action, int off)
return (wo + eo * 2) << off;
}
-int CheckCommand::execute (Cmdline const & cl)
-{
- if (cl.arguments.size () == 0)
+int doKDBcheck (bool force)
{
Key x;
try
@@ -56,7 +54,7 @@ int CheckCommand::execute (Cmdline const & cl)
}
ret += printProblems (a, "getting", 2);
- if (cl.force)
+ if (force)
{
Key b ("/", KEY_END);
try
@@ -81,9 +79,11 @@ int CheckCommand::execute (Cmdline const & cl)
}
}
- if (cl.arguments.size () != 1)
+int CheckCommand::execute (Cmdline const & cl)
+{
+ if (cl.arguments.size () == 0)
{
- throw invalid_argument ("One argument required");
+ return doKDBcheck (cl.force);
}
std::string name = cl.arguments[0];
