@zseven-w/openpencil
v0.6.0
Published
CLI for OpenPencil — control the design tool from your terminal
Downloads
434
Readme
@zseven-w/openpencil
English · 简体中文 · 繁體中文 · 日本語 · 한국어 · Français · Español · Deutsch · Português · Русский · हिन्दी · Türkçe · ไทย · Tiếng Việt · Bahasa Indonesia
OpenPencil 的命令行工具 — 从终端控制设计工具。
安装
npm install -g @zseven-w/openpencil平台支持
CLI 会自动检测并启动各平台上的 OpenPencil 桌面应用:
| 平台 | 检测的安装路径 |
| ----------- | --------------------------------------------------------------------------------------------------- |
| macOS | /Applications/OpenPencil.app, ~/Applications/OpenPencil.app |
| Windows | NSIS 用户级 (%LOCALAPPDATA%)、系统级 (%PROGRAMFILES%)、便携版 |
| Linux | /usr/bin, /usr/local/bin, ~/.local/bin, AppImage (~/Applications, ~/Downloads), Snap, Flatpak |
用法
op <command> [options]输入方式
接受 JSON 或 DSL 的参数支持三种传入方式:
op design '...' # 内联字符串(适合小型内容)
op design @design.txt # 从文件读取(推荐用于大型设计)
cat design.txt | op design - # 从标准输入读取(管道传入)应用控制
op start [--desktop|--web] # 启动 OpenPencil(默认桌面版)
op stop # 停止运行中的实例
op status # 检查运行状态设计(批量 DSL)
op design <dsl|@file|-> [--post-process] [--canvas-width N]
op design:skeleton <json|@file|->
op design:content <section-id> <json|@file|->
op design:refine --root-id <id>文档操作
op open [file.op] # 打开文件或连接到实时画布
op save <file.op> # 保存当前文档
op get [--type X] [--name Y] [--id Z] [--depth N]
op selection # 获取当前画布选中项节点操作
op insert <json> [--parent P] [--index N] [--post-process]
op update <id> <json> [--post-process]
op delete <id>
op move <id> --parent <P> [--index N]
op copy <id> [--parent P]
op replace <id> <json> [--post-process]代码导出
op export <format> [--out file]
# 格式:react, html, vue, svelte, flutter, swiftui, compose, rn, css变量与主题
op vars # 获取变量
op vars:set <json> # 设置变量
op themes # 获取主题
op themes:set <json> # 设置主题
op theme:save <file.optheme> # 保存主题预设
op theme:load <file.optheme> # 加载主题预设
op theme:list [dir] # 列出主题预设页面
op page list # 列出页面
op page add [--name N] # 添加页面
op page remove <id> # 删除页面
op page rename <id> <name> # 重命名页面
op page reorder <id> <index> # 调整页面顺序
op page duplicate <id> # 复制页面导入
op import:svg <file.svg> # 导入 SVG 文件
op import:figma <file.fig> # 导入 Figma .fig 文件布局
op layout [--parent P] [--depth N]
op find-space [--direction right|bottom|left|top]全局选项
--file <path> 目标 .op 文件(默认:实时画布)
--page <id> 目标页面 ID
--pretty 人类可读的 JSON 输出
--help 显示帮助
--version 显示版本许可证
MIT
