forked from openthread/openthread
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cli] simplify argument processing (openthread#6767)
This commit changes `ParseCmd()` such that as `aArgs` array entries are populated with parsed arguments from a command line string, the remaining unused `aArgs` entries in the array are marked as "empty". We also ensure that the `aArgs[]` array always end with an "empty" `Arg` which indicates end of the list (this is similar to how C string ends with a null '\0' character). This commit also changes different methods of `Arg` class (`Arg::ParseAs{Type}()` or overload of operator `==`, etc) to check and handle when `Arg` is marked as "empty". These changes help simplify how the arguments are processed in CLI modules. In `Cli::Process{Command}()` methods we can just pass the `aArgs[]` array and do not need to pass a separate args length parameter. In many cases the args length checks can be removed since it will be checked from `ParseAs{Type}()` call.
- Loading branch information
Showing
23 changed files
with
1,286 additions
and
1,416 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.