SDKtool: Fix return values and improve error reporting

Change-Id: I1a44a39d5cd96be48608fdb4fab252a51046971e
Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
Tobias Hunger
2013-02-07 10:42:24 +01:00
parent c8a34f05a0
commit 56582e8c06
11 changed files with 90 additions and 33 deletions

View File

@@ -59,8 +59,10 @@ bool AddKeysOperation::setArguments(const QStringList &args)
continue;
}
if (next.isNull())
if (next.isNull()) {
std::cerr << "Missing value for key '" << qPrintable(current) << "'." << std::endl << std::endl;
return false;
}
++i;
KeyValuePair pair(current, next);
@@ -81,10 +83,10 @@ int AddKeysOperation::execute() const
map = addKeys(map, m_data);
if (map.isEmpty())
return 1;
return -4;
// Write data again:
return save(map, m_file) ? 0 : 2;
return save(map, m_file) ? 0 : -5;
}
#ifdef WITH_TESTS