Commit 42e00a18 authored by nicolas's avatar nicolas

fix(Cli): better test when passing uri as cli, and an argument is missing

parent bd0c9bdd
...@@ -123,7 +123,7 @@ void Cli::Command::execute (QHash<QString, QString> &args) const { ...@@ -123,7 +123,7 @@ void Cli::Command::execute (QHash<QString, QString> &args) const {
// Check missing arguments. // Check missing arguments.
for (const auto &argName : mArgsScheme.keys()) { for (const auto &argName : mArgsScheme.keys()) {
if (!args.contains(argName) && !mArgsScheme[argName].isOptional) { if (!mArgsScheme[argName].isOptional && (!args.contains(argName) || args[argName].isEmpty())) {
qWarning() << QStringLiteral("Missing argument for command: `%1 (%2)`.") qWarning() << QStringLiteral("Missing argument for command: `%1 (%2)`.")
.arg(mFunctionName).arg(argName); .arg(mFunctionName).arg(argName);
return; return;
...@@ -220,6 +220,7 @@ void Cli::executeCommand (const QString &command, CommandFormat *format) const { ...@@ -220,6 +220,7 @@ void Cli::executeCommand (const QString &command, CommandFormat *format) const {
return; return;
} }
//TODO: check if there is any header when the `method` header is missing.
const QString functionName = ::Utils::coreStringToAppString(address->getHeader("method")).isEmpty() const QString functionName = ::Utils::coreStringToAppString(address->getHeader("method")).isEmpty()
? QStringLiteral("call") ? QStringLiteral("call")
: ::Utils::coreStringToAppString(address->getHeader("method")); : ::Utils::coreStringToAppString(address->getHeader("method"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment