diff options
Diffstat (limited to 'unix/input.c')
-rw-r--r-- | unix/input.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/unix/input.c b/unix/input.c index 626138b42e..2676b2e224 100644 --- a/unix/input.c +++ b/unix/input.c @@ -35,6 +35,7 @@ #if MICROPY_USE_READLINE #include <readline/readline.h> #include <readline/history.h> +#include <readline/tilde.h> #endif char *prompt(char *p) { @@ -62,6 +63,18 @@ char *prompt(char *p) { return line; } +void prompt_read_history(void) { +#if MICROPY_USE_READLINE_HISTORY + read_history(tilde_expand("~/.micropython.history")); +#endif +} + +void prompt_write_history(void) { +#if MICROPY_USE_READLINE_HISTORY + write_history(tilde_expand("~/.micropython.history")); +#endif +} + STATIC mp_obj_t mp_builtin_input(uint n_args, const mp_obj_t *args) { if (n_args == 1) { mp_obj_print(args[0], PRINT_STR); |