File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1010from pathlib import Path
1111from prompt_toolkit .shortcuts import PromptSession
1212from prompt_toolkit .completion import NestedCompleter
13+ from prompt_toolkit .history import FileHistory
1314
1415from meshcore import TCPConnection , BLEConnection , SerialConnection
1516from meshcore import MeshCore , EventType , logger
1617
1718# default ble address is stored in a config file
1819MCCLI_CONFIG_DIR = str (Path .home ()) + "/.config/meshcore/"
1920MCCLI_ADDRESS = MCCLI_CONFIG_DIR + "default_address"
21+ MCCLI_HISTORY_FILE = MCCLI_CONFIG_DIR + "history"
2022
2123# Fallback address if config file not found
2224# if None or "" then a scan is performed
@@ -170,8 +172,14 @@ async def interactive_loop(mc, to=None) :
170172 "to" : None ,
171173 "send" : None ,
172174 }
175+
173176 completer = NestedCompleter .from_nested_dict (make_completion_dict (mc .contacts ))
174- session = PromptSession (completer = completer )
177+ if os .path .isdir (MCCLI_CONFIG_DIR ) :
178+ our_history = FileHistory (MCCLI_HISTORY_FILE )
179+ else :
180+ our_history = None
181+
182+ session = PromptSession (completer = completer , history = our_history )
175183
176184 last_ack = True
177185 while True :
You can’t perform that action at this time.
0 commit comments