From 7e6806444634b520451935df308b02e56b6c6f07 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Mon, 19 Apr 2021 00:33:59 +0200 Subject: [PATCH] Allow to see help offline --- client/src/cmdparser.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client/src/cmdparser.c b/client/src/cmdparser.c index 279f87664..653aaba55 100644 --- a/client/src/cmdparser.c +++ b/client/src/cmdparser.c @@ -240,10 +240,16 @@ int CmdsParse(const command_t Commands[], const char *Cmd) { if (cmd_name[0] == '#') return PM3_SUCCESS; + // find args, check for -h / --help + int tmplen = len; + while (Cmd[tmplen] == ' ') + ++tmplen; + bool request_help = (strcmp(Cmd+tmplen, "-h") == 0) || (strcmp(Cmd+tmplen, "--help") == 0); + int i = 0; while (Commands[i].Name) { if (0 == strcmp(Commands[i].Name, cmd_name)) { - if (Commands[i].IsAvailable()) { + if (request_help || Commands[i].IsAvailable()) { break; } else { PrintAndLogEx(WARNING, "This command is " _YELLOW_("not available") " in this mode");