diff options
author | Damien George <damien@micropython.org> | 2021-07-27 00:43:35 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2022-03-10 10:58:33 +1100 |
commit | ac2293161e98e73d39434628f995e85bd97e52c2 (patch) | |
tree | 6cc14ad736b124e085371ec47e734b90f7e98ddd /py/repl.c | |
parent | cac939ddc3625da7e6cf1cf0309daba25fc1cedb (diff) |
py/modsys: Add optional mutable attributes sys.ps1/ps2 and use them.
This allows customising the REPL prompt strings.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/repl.c')
-rw-r--r-- | py/repl.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -33,6 +33,16 @@ #if MICROPY_HELPER_REPL +#if MICROPY_PY_SYS_PS1_PS2 +const char *mp_repl_get_psx(unsigned int entry) { + if (mp_obj_is_str(MP_STATE_VM(sys_mutable)[entry])) { + return mp_obj_str_get_str(MP_STATE_VM(sys_mutable)[entry]); + } else { + return ""; + } +} +#endif + STATIC bool str_startswith_word(const char *str, const char *head) { size_t i; for (i = 0; str[i] && head[i]; i++) { |