代码拉取完成,页面将自动刷新
简易文件操作类工具,仅适用于MicroPython
(并且只在ESP32
下测试过)
命令 | 说明 |
---|---|
cat | 查看文件内容 |
rm | 删除文件或文件夹 (未实现) |
ls | 列出目录下的文件 (未实现) |
原型:cat(filename, ln)
说明:查看文件内容
参数
filename
:文件名ln
:是否显示行号,默认 True假设项目保存在/tools
文件夹下,目录树如图所示:
...
├─tools
│ ├─__init__.py
│ ├─cat.py
│ ├─ls.py
│ └─rm.py
...
将/tools
文件夹连同你的项目文件一起下载到开发板,进入repl
模式输入命令
>>> from tools import *
Walkline's Tools
>>> cat("boot.py")
1 # This file is executed on every boot (including wake-boot from deepsleep)
2 import esp
3 esp.osdebug(None)
4 #import webrepl
5 #webrepl.start()
可以直接下载项目压缩包,解压缩放入你的项目指定目录(如/tools
)即可,缺点是本项目更新后需要重新下载并覆盖原文件
使用子模块
方式加入到你的项目中,简单操作说明如下:
添加子模块
cd your_project/
git submodule add --force https://gitee.com/walkline/micropython-file-tools.git tools
git add .gitmodules tools
git commit -m "add tools submodule"
git push
更新子模块
cd your_project/tools/
git checkout master
git pull
cd ..
git add tools
git commit -m "update tools submodule"
git push
此操作有待核实
删除子模块
cd your_project/
git rm --cached tools
rm -rf tools
rm .gitmodules
vim .git/config
# 打开 config 文件后
# 删除 [submodule "tools"] 相关内容
# 保存后退出
git add .
git commit -m "remove tools submodule"
git push
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。