refactor(cli): 重构CLI模块结构,整理系统工具与开发工具
1. 将原cli根目录下的clearscreen、taskkill、which工具迁移到cli/system子目录 2. 新增cli/dev子目录并添加envdev环境配置工具 3. 更新pyproject.toml中的脚本入口点映射 4. 调整tests/cli下的测试文件导入路径 5. 整理tasks/system.py的__all__导出顺序
This commit is contained in:
+6
-4
@@ -26,9 +26,7 @@ version = "0.2.10"
|
|||||||
[project.scripts]
|
[project.scripts]
|
||||||
autofmt = "pyflowx.cli.autofmt:main"
|
autofmt = "pyflowx.cli.autofmt:main"
|
||||||
bumpversion = "pyflowx.cli.bumpversion:main"
|
bumpversion = "pyflowx.cli.bumpversion:main"
|
||||||
clr = "pyflowx.cli.clearscreen:main"
|
|
||||||
emlman = "pyflowx.cli.emlmanager:main"
|
emlman = "pyflowx.cli.emlmanager:main"
|
||||||
envdev = "pyflowx.cli.envdev:main"
|
|
||||||
filedate = "pyflowx.cli.filedate:main"
|
filedate = "pyflowx.cli.filedate:main"
|
||||||
filelvl = "pyflowx.cli.filelevel:main"
|
filelvl = "pyflowx.cli.filelevel:main"
|
||||||
foldback = "pyflowx.cli.folderback:main"
|
foldback = "pyflowx.cli.folderback:main"
|
||||||
@@ -44,8 +42,12 @@ reseticon = "pyflowx.cli.reseticoncache:main"
|
|||||||
scrcap = "pyflowx.cli.screenshot:main"
|
scrcap = "pyflowx.cli.screenshot:main"
|
||||||
sglang = "pyflowx.cli.llm.sglang:main"
|
sglang = "pyflowx.cli.llm.sglang:main"
|
||||||
sshcopy = "pyflowx.cli.sshcopyid:main"
|
sshcopy = "pyflowx.cli.sshcopyid:main"
|
||||||
taskk = "pyflowx.cli.taskkill:main"
|
# dev
|
||||||
wch = "pyflowx.cli.which:main"
|
envdev = "pyflowx.cli.dev.envdev:main"
|
||||||
|
# system
|
||||||
|
clr = "pyflowx.cli.system.clearscreen:main"
|
||||||
|
taskk = "pyflowx.cli.system.taskkill:main"
|
||||||
|
wch = "pyflowx.cli.system.which:main"
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
dev = [
|
dev = [
|
||||||
|
|||||||
@@ -35,6 +35,6 @@ def main() -> None:
|
|||||||
[
|
[
|
||||||
px.TaskSpec(f"kill_{proc_name}", cmd=[*cmd, f"{proc_name}*"], verbose=True)
|
px.TaskSpec(f"kill_{proc_name}", cmd=[*cmd, f"{proc_name}*"], verbose=True)
|
||||||
for proc_name in args.process_names
|
for proc_name in args.process_names
|
||||||
]
|
],
|
||||||
)
|
)
|
||||||
px.run(graph, strategy="thread")
|
px.run(graph, strategy="thread")
|
||||||
@@ -6,6 +6,15 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"clr",
|
||||||
|
"reset_icon_cache",
|
||||||
|
"setenv",
|
||||||
|
"setenv_group",
|
||||||
|
"which",
|
||||||
|
"write_file",
|
||||||
|
]
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -111,6 +120,3 @@ def write_file(path: str, content: str, encoding: str = "utf-8") -> px.TaskSpec:
|
|||||||
print(f"写入文件 {path} 失败: {e}")
|
print(f"写入文件 {path} 失败: {e}")
|
||||||
|
|
||||||
return px.TaskSpec(f"write_file_{path}", fn=write, verbose=True)
|
return px.TaskSpec(f"write_file_{path}", fn=write, verbose=True)
|
||||||
|
|
||||||
|
|
||||||
__all__ = ["clr", "reset_icon_cache", "setenv", "setenv_group", "which", "write_file"]
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from __future__ import annotations
|
|||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pyflowx as px
|
import pyflowx as px
|
||||||
from pyflowx.cli import clearscreen
|
from pyflowx.cli.system import clearscreen
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------- #
|
# ---------------------------------------------------------------------- #
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from unittest.mock import patch
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import pyflowx as px
|
import pyflowx as px
|
||||||
from pyflowx.cli import taskkill
|
from pyflowx.cli.system import taskkill
|
||||||
from pyflowx.conditions import Constants
|
from pyflowx.conditions import Constants
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user