跳转到内容

维基

wiki 命令(别名 w)用于读写项目 Wiki 中的页面。

每个子命令都需要指定项目,可通过 --project <identifier> 传入,或依赖当前认证配置的默认项目(参见 auth)。

Terminal window
redmine wiki list [flags]

别名:ls。列出每个页面的标题和最后修改时间。结果在服务器端分页;若需遍历较大的 Wiki,可结合 --limit 0--offset 使用。

标志描述
--project项目标识符或数字 ID。未指定时回退到当前认证配置的默认项目。
--limit最大返回数量(0 表示全部)
--offset分页偏移量
-o, --output输出格式:tablejsoncsv
Terminal window
redmine wiki list --project myproject
Terminal window
redmine wiki get <page> [flags]

别名:showview。打印页面的元数据以及完整的 Textile/Markdown 源文本。传入 --version 可获取历史版本而非当前版本。

标志描述
--project项目标识符或数字 ID
--version要获取的页面版本号(省略或填 0 表示最新版本)
--include包含关联数据,仅支持 attachments
-o, --output输出格式
Terminal window
redmine wiki get WikiStart --project myproject
redmine wiki get WikiStart --project myproject --version 3
redmine wiki get WikiStart --project myproject --include attachments
Terminal window
redmine wiki create <page> [flags]

别名:new。创建一个新的 Wiki 页面。若同名页面已存在,Redmine 会覆盖它;若希望确保是在编辑而非替换,请改用 update

标志描述
--project项目标识符或数字 ID
-t, --textTextile/Markdown 格式的页面内容。必填
--title显示标题(默认为页面名)
--comments记录在页面历史中的修改备注
--attach要附加的文件路径(可重复)
-o, --output输出格式
Terminal window
redmine wiki create MyPage --project myproject --text "h1. Hello World"
redmine wiki create MyPage --project myproject \
--text "Content here" --title "My Page" --comments "Initial draft"
redmine wiki create MyPage --project myproject \
--text "See diagram" --attach ./diagram.png
Terminal window
redmine wiki update <page> [flags]

别名:edit。编辑已有页面,仅传入的字段会被修改。当省略 --text 时,命令会先获取当前页面文本并原样回传,因此只修改标题或备注时不会清空内容。

标志描述
--project项目标识符或数字 ID
-t, --text新的页面内容,省略时保留当前文本
--title新的显示标题
--comments记录在页面历史中的修改备注
--attach要附加的文件路径(可重复)
Terminal window
redmine wiki update MyPage --project myproject --text "Updated content"
redmine wiki update MyPage --project myproject --comments "Fixed typo"
redmine wiki update MyPage --project myproject --title "New Title"
redmine wiki update MyPage --project myproject --attach ./screenshot.png
破坏性操作
Terminal window
redmine wiki delete <page> [flags]

别名:rm。永久删除该页面,包括其所有附件和版本历史。子页面不会被一并删除,而是重新挂载到 Wiki 根节点下。

标志描述
--project项目标识符或数字 ID
-f, --force跳过确认提示
Terminal window
redmine wiki delete MyPage --project myproject
redmine wiki delete MyPage --project myproject --force