REPL: ignore blank lines.
Signed-off-by: Yilin Sun <imi415@imi.moe>
This commit is contained in:
parent
6b98725b34
commit
9b4660bd75
|
@ -1,4 +1,5 @@
|
|||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
|
||||
/* FreeRTOS */
|
||||
#include "FreeRTOS.h"
|
||||
|
@ -67,7 +68,7 @@ int app_mrb_repl_exec(bool *exit) {
|
|||
uint32_t heap_used, heap_total;
|
||||
|
||||
app_mrb_repl_heap_usage(&heap_used, &heap_total);
|
||||
snprintf(prompt_str, 64, "[%4.02lfkiB/%4.02lfkiB](irb)> ", APP_B_TO_KF(heap_used), APP_B_TO_KF(heap_total));
|
||||
snprintf(prompt_str, 64, "[%.02lf/%.02lfkiB](mirb)> ", APP_B_TO_KF(heap_used), APP_B_TO_KF(heap_total));
|
||||
|
||||
line = linenoise(prompt_str);
|
||||
|
||||
|
@ -76,8 +77,11 @@ int app_mrb_repl_exec(bool *exit) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
linenoiseHistoryAdd(line);
|
||||
printf("You entered: %s\n", line);
|
||||
if(strlen(line) != 0) {
|
||||
linenoiseHistoryAdd(line);
|
||||
printf("You entered: %s\n", line);
|
||||
}
|
||||
|
||||
free(line);
|
||||
|
||||
*exit = false;
|
||||
|
|
|
@ -46,7 +46,7 @@ static void app_mrb_runtime_task(void *parameters) {
|
|||
|
||||
for (;;) {
|
||||
exit_repl = false;
|
||||
|
||||
|
||||
if(app_mrb_repl_init() != 0){
|
||||
printf("Failed to initialize mruby REPL engine.\n");
|
||||
goto task_fail;
|
||||
|
|
Loading…
Reference in New Issue