25 while (*args ==
' ' || *args ==
'\t') ++args;
27 while (*args && !std::isspace(
static_cast<unsigned char>(*args))) ++args;
28 name_len =
static_cast<size_t>(args -
name);
29 while (*args ==
' ' || *args ==
'\t') ++args;
38 return std::strlen(word) == token_len &&
39 strncasecmp(token, word, token_len) == 0;
54 if (e->args && *e->args) {
55 std::snprintf(head,
sizeof(head),
"%s %s", e->name, e->args);
57 std::snprintf(head,
sizeof(head),
"%s", e->name);
77 const char* sub =
nullptr;
79 const char* rest =
nullptr;
90 if (e->handler) e->handler(rest);
96 parent,
static_cast<int>(sub_len), sub);
char name[cdc::hal::ISecureElement::RMEM_NAME_LEN]
static void printf(const char *format,...) __attribute__((format(printf
Prints formatted text to console.
bool subCommandEquals(const char *token, size_t token_len, const char *word)
Case-insensitive compare of an unterminated token against a word.
constexpr size_t kSubCommandHeadBufSize
Buffer size for the "<name> <args>" column built during HELP rendering.
void parseSubCommand(const char *args, const char *&name, size_t &name_len, const char *&rest)
Splits args into "<sub-command> <rest>".
void printSubCommandHelp(const char *parent, const SubCommand *table)
Prints a sub-command summary block.
void dispatchSubCommand(const char *parent, const char *args, const SubCommand *table)
Routes a sub-command line to its handler.
const char * name
Sub-command keyword, e.g. "LIST". nullptr terminates the array.