mirror of
https://github.com/espressif/openthread.git
synced 2026-09-17 22:50:07 +00:00
[cli] adding helper method ParseEnableOrDisable() (#6426)
This commit adds a helper method `Cli::ParseEnableOrDisable()` which checks a given string against two common commands "enable" or "disable". This method is then used in CLI modules.
This commit is contained in:
+1
-9
@@ -216,17 +216,9 @@ otError UdpExample::ProcessLinkSecurity(uint8_t aArgsLength, char *aArgs[])
|
||||
{
|
||||
mInterpreter.OutputEnabledDisabledStatus(mLinkSecurityEnabled);
|
||||
}
|
||||
else if (strcmp(aArgs[0], "enable") == 0)
|
||||
{
|
||||
mLinkSecurityEnabled = true;
|
||||
}
|
||||
else if (strcmp(aArgs[0], "disable") == 0)
|
||||
{
|
||||
mLinkSecurityEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
error = OT_ERROR_INVALID_COMMAND;
|
||||
error = Interpreter::ParseEnableOrDisable(aArgs[0], mLinkSecurityEnabled);
|
||||
}
|
||||
|
||||
return error;
|
||||
|
||||
Reference in New Issue
Block a user