Add simple command prompt '>'. (#117)

This commit is contained in:
Jonathan Hui
2016-06-08 09:20:36 -07:00
parent fba6f03d7e
commit 6c310bf6bf
3 changed files with 54 additions and 52 deletions
+4 -2
View File
@@ -49,6 +49,7 @@
namespace Thread {
namespace Cli {
static const char sCommandPrompt[] = {'>', ' '};
static const char sEraseString[] = {'\b', ' ', '\b'};
static const char CRNL[] = {'\r', '\n'};
static Serial *sServer;
@@ -93,14 +94,15 @@ void Serial::ReceiveTask(const uint8_t *aBuf, uint16_t aBufLength)
ProcessCommand();
}
Output(sCommandPrompt, sizeof(sCommandPrompt));
break;
case '\b':
case 127:
Output(sEraseString, sizeof(sEraseString));
if (mRxLength > 0)
{
Output(sEraseString, sizeof(sEraseString));
mRxBuffer[--mRxLength] = '\0';
}