webrepl_cli.py: Add support for uploading directory.#81
Open
mo-vic wants to merge 1 commit intomicropython:masterfrom
Open
webrepl_cli.py: Add support for uploading directory.#81mo-vic wants to merge 1 commit intomicropython:masterfrom
mo-vic wants to merge 1 commit intomicropython:masterfrom
Conversation
Allow user to upload directory recursively,
for example:
$ ./webrepl_cli.py -p x ./package 192.168.4.1:/
Signed-off-by: movic <movic.chen@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow user to upload directory recursively
for example:
Description:
This patch introduces the ability to upload entire directories to a MicroPython device via WebREPL. This enhancement is particularly useful when working with Python packages or other resources that consist of multiple files and subdirectories. Previously, users had to upload files one by one, which was tedious and time-consuming, especially for larger projects.
Key Features:
Directory Upload: Added the put_dir function to recursively upload a local directory and its contents to the remote device.
Directory Creation: Added a helper function create_directory to remotely create directories on the MicroPython device.
Command Execution: Implemented the run_command function to facilitate the execution of arbitrary commands on the device via WebREPL.
Main Function Enhancement: Updated the main function to automatically detect whether the user intends to upload a file or a directory and handle the operation accordingly.
Improved Help Information: Updated the help message to reflect the new functionality.
Use Case:
This feature is essential for scenarios where developers need to upload Python packages, resources, or any structured data to a device running MicroPython. By supporting directory uploads, this patch streamlines the development and deployment process, making it more efficient and less error-prone.
Testing:
This patch has been tested in various scenarios, including:
These tests confirm that the new functionality works as intended without introducing regressions or performance issues.
Backward Compatibility:
The changes are fully backward compatible. Existing workflows that involve uploading individual files remain unaffected.