diff --git a/client/src/cmdmain.c b/client/src/cmdmain.c index e6ecc0919..f66e5016c 100644 --- a/client/src/cmdmain.c +++ b/client/src/cmdmain.c @@ -247,6 +247,11 @@ static int CmdPref(const char *Cmd) { return PM3_SUCCESS; } +static int CmdClear(const char *Cmd) { + PrintAndLogEx(NORMAL, _CLEAR_ _TOP_ ""); + return PM3_SUCCESS; +} + static command_t CommandTable[] = { {"--------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("Technology") " -----------------------"}, @@ -265,7 +270,8 @@ static command_t CommandTable[] = { {"usart", CmdUsart, IfPm3FpcUsartFromUsb, "{ USART commands... }"}, {"wiegand", CmdWiegand, AlwaysAvailable, "{ Wiegand format manipulation... }"}, {"--------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("General") " -----------------------"}, - {"auto", CmdAuto, IfPm3Present, "Automated detection process for unknown tags"}, + {"auto", CmdAuto, IfPm3Present, "Automated detection process for unknown tags"}, + {"clear", CmdClear, AlwaysAvailable, "clear screen"}, {"help", CmdHelp, AlwaysAvailable, "This help. Use " _YELLOW_("' help'") " for details of a particular command."}, {"hints", CmdHints, AlwaysAvailable, "Turn hints on / off"}, {"msleep", CmdMsleep, AlwaysAvailable, "Add a pause in milliseconds"}, diff --git a/include/ansi.h b/include/ansi.h index 28784ba8c..6c808d10e 100644 --- a/include/ansi.h +++ b/include/ansi.h @@ -11,6 +11,9 @@ #define _CYAN_(s) "\x1b[36m" s AEND #define _WHITE_(s) "\x1b[37m" s AEND +#define _CLEAR_ "\x1b[2J" +#define _TOP_ "\x1b[1;1f" + // https://wiki.hackzine.org/development/misc/readline-color-prompt.html // Applications may indicate that the prompt contains // characters that take up no physical screen space when displayed by