Advanced1 分钟

桌面版CLI使用说明

如何使用命令行界面

Desktop CLI 使用

如何使用 Desktop(¥4,500)中包含的 CLI 工具。


📍 基本命令

# YAML → JSON
yamlforge convert input.yaml -o output.json

# JSON → YAML
yamlforge convert input.json -o output.yaml

# 输出到 stdout
yamlforge convert input.yaml

⚙️ 选项

选项描述默认值
-o, --output输出文件stdout
--preserve-anchors保留锚点true
--preserve-comments保留注释true
--indent缩进大小2
--sort-keys排序键false

📁 批量处理

# 将目录中的所有 YAML 转换为 JSON
yamlforge batch ./configs --pattern "*.yaml" --output ./json

# 递归处理
yamlforge batch ./configs --pattern "**/*.yaml" --recursive

🔧 管道集成

# 从 stdin 读取
cat config.yaml | yamlforge convert --stdin

# 与 jq 结合
yamlforge convert config.yaml | jq '.server.port'
标签
#cli#desktop#advanced#command-line#batch