tools/mpremote: Add "umount" command.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2022-02-25 13:10:45 +11:00
parent ad1f523e7e
commit d6564a3159
3 changed files with 10 additions and 0 deletions

View File

@ -135,6 +135,12 @@ The full list of supported commands are:
$ mpremote mount <local-dir>
- unmount the local directory from the remote device:
.. code-block:: bash
$ mpremote umount
Multiple commands can be specified and they will be run sequentially.

View File

@ -42,6 +42,7 @@ _COMMANDS = {
"resume": (False, False, 0, "resume a previous mpremote session (will not auto soft-reset)"),
"soft-reset": (False, True, 0, "perform a soft-reset of the device"),
"mount": (True, False, 1, "mount local directory on device"),
"umount": (True, False, 0, "unmount the local directory"),
"repl": (
False,
True,
@ -493,6 +494,8 @@ def main():
path = args.pop(0)
pyb.mount_local(path)
print(f"Local directory {path} is mounted at /remote")
elif cmd == "umount":
pyb.umount_local()
elif cmd in ("exec", "eval", "run"):
follow = True
if args[0] == "--no-follow":

View File

@ -687,3 +687,4 @@ class PyboardExtended(Pyboard):
if self.mounted:
self.exec_('uos.umount("/remote")')
self.mounted = False
self.serial = self.serial.orig_serial