名称: ecto
描述: 用于管理博客文章、页面、标签和内容的 Ghost.io 管理 API 命令行工具。
通过 Ghost.io 的管理 API 管理博客。支持多站点配置、Markdown 到 HTML 的转换以及用于脚本处理的 JSON 输出。
ecto auth add <名称> --url <ghost-url> --key <admin-api-key>
ecto auth list
ecto auth default <名称>
ecto auth remove <名称>
环境变量覆盖:GHOST_URL, GHOST_ADMIN_KEY, GHOST_SITE
ecto posts [--status draft|published|scheduled|all] [--limit N] [--json]
ecto post <id|slug> [--json] [--body]
ecto post create --title "标题" [--markdown-file file.md] [--stdin-format markdown] [--tag tag1,tag2] [--status draft|published]
ecto post edit <id|slug> [--title "新标题"] [--markdown-file file.md] [--status draft|published]
ecto post delete <id|slug> [--force]
ecto post publish <id|slug>
ecto post unpublish <id|slug>
ecto post schedule <id|slug> --at "2025-01-25T10:00:00Z"
ecto pages [--status draft|published|all] [--limit N] [--json]
ecto page <id|slug> [--json] [--body]
ecto page create --title "标题" [--markdown-file file.md] [--status draft|published]
ecto page edit <id|slug> [--title "新标题"] [--markdown-file file.md]
ecto page delete <id|slug> [--force]
ecto page publish <id|slug>
ecto tags [--json]
ecto tag <id|slug> [--json]
ecto tag create --name "标签名" [--description "描述"]
ecto tag edit <id|slug> [--name "新名称"] [--description "描述"]
ecto tag delete <id|slug> [--force]
ecto image upload <路径> [--json]
ecto site [--json]
ecto settings [--json]
ecto users [--json]
ecto user <id|slug> [--json]
ecto newsletters [--json]
ecto newsletter <id> [--json]
ecto webhook create --event <事件> --target-url <url> [--name "钩子名称"]
ecto webhook delete <id> [--force]
支持的事件:post.published, post.unpublished, post.added, post.deleted, page.published 等。
使用 --site <名称> 来指定一个已配置的站点:
ecto posts --site blog2
从 Markdown 文件创建并发布文章:
ecto post create --title "我的文章" --markdown-file post.md --tag blog --status published
从标准输入管道传入内容:
echo "# 你好,世界" | ecto post create --title "快速文章" --stdin-format markdown
定时发布文章:
ecto post schedule future-post --at "2025-02-01T09:00:00Z"
批量发布草稿:
for id in $(ecto posts --status draft --json | jq -r '.posts[].id'); do
ecto post publish "$id"
done
运行 ecto --ai-help 获取完整的文档。