mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
Add a option to clear the scrollback buffer
This commit is contained in:
parent
27d9be7613
commit
a7bc082d2d
2 changed files with 11 additions and 2 deletions
|
@ -300,15 +300,23 @@ static int CmdClear(const char *Cmd) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "clear",
|
CLIParserInit(&ctx, "clear",
|
||||||
"Clear the Proxmark3 client terminal screen",
|
"Clear the Proxmark3 client terminal screen",
|
||||||
"clear"
|
"clear -> clear the terminal screen\n"
|
||||||
|
"clear -b -> clear the terminal screen and the scrollback buffer"
|
||||||
);
|
);
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
|
arg_lit0("b", "back", "also clear the scrollback buffer"),
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
bool scrollback = arg_get_lit(ctx, 1);
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
|
if (!scrollback)
|
||||||
PrintAndLogEx(NORMAL, _CLEAR_ _TOP_ "");
|
PrintAndLogEx(NORMAL, _CLEAR_ _TOP_ "");
|
||||||
|
else
|
||||||
|
PrintAndLogEx(NORMAL, _CLEAR_ _TOP_ _CLEAR_SCROLLBACK_ "");
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
#define _BACK_BRIGHT_WHITE_(s) "\x1b[47;1m" s AEND
|
#define _BACK_BRIGHT_WHITE_(s) "\x1b[47;1m" s AEND
|
||||||
|
|
||||||
#define _CLEAR_ "\x1b[2J"
|
#define _CLEAR_ "\x1b[2J"
|
||||||
|
#define _CLEAR_SCROLLBACK_ "\x1b[3J"
|
||||||
#define _TOP_ "\x1b[1;1f"
|
#define _TOP_ "\x1b[1;1f"
|
||||||
|
|
||||||
#if defined(HAVE_READLINE)
|
#if defined(HAVE_READLINE)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue