sunlight-cms / console
Sunlight CMS 命令行工具
Requires
- php: >=7.1
- composer/semver: ^3.3.2
- kuria/debug: ^4.0.1
- kuria/options: ^2.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.26
- sunlight-cms/sunlight-cms: dev-master
- vimeo/psalm: ^5.15
This package is auto-updated.
Last update: 2024-08-30 01:39:47 UTC
README
此库提供各种 CLI 命令,以帮助开发和管理 SunLight CMS 项目。
内容
安装
SunLight CMS 框架 已经预先配置了这个控制台。
如果您想将此控制台添加到非框架项目的项目中,您可以使用 Composer 来实现。
composer require sunlight-cms/console
配置
控制台将从您的项目的 composer.json 文件中读取配置。
{ // ... "extra": { "sunlight-console": { "cms": { "version": "latest" } } } }
支持选项
cms
与 CMS 文件下载方式相关的选项。
版本
必需
要下载的 CMS 版本。
如果 cms.archive 中设置了 zip-url
,CMS 将从指定的 URL 下载。在这种情况下,版本字符串可以有任何格式。
如果 cms.archive 配置为使用 git 仓库,版本字符串可以采用以下格式
latest
- 将下载最新支持的版本(并更新cms.version
为该版本)8.0.0
- 将下载确切的标记版本~8.0.0
- 将找到并下载与 约束 匹配的标记版本dev-master
- 将下载指定分支的最新版本
存档
默认:配置为使用 https://github.com/sunlight-cms/sunlight-cms
"archive": { "zip-url": null, "zip-paths-prefix": "sunlight-cms-%version%/", "git-url": "https://github.com/sunlight-cms/sunlight-cms.git", "git-branch-zip-url": "https://github.com/sunlight-cms/sunlight-cms/archive/refs/heads/%version%.zip", "git-tag-zip-url": "https://github.com/sunlight-cms/sunlight-cms/archive/refs/tags/v%version%.zip", "git-tag-pattern": "v8*" }
zip-url
- CMS 存档下载 URL 或null
以使用 git 仓库zip-paths-prefix
- 存档中路径的前缀(可以为空)git-url
- 扫描标记的 git 仓库 URL 或null
git-branch-zip-url
- 作为 .zip 文件提供分支的 URL 或null
git-tag-zip-url
- 作为 .zip 文件提供标记的 URL 或null
git-tag-pattern
- 标记匹配模式(用于 git ls-remote)或null
注意
zip-paths-prefix
、git-branch-zip-url
和 git-tag-zip-url
可能包含一个 %version%
占位符,它将被指定的 cms.version 替换
插件
默认:无插件
要从 CMS 存档中提取的插件列表。模板不会被覆盖。
"plugins": { "extend": [ "devkit", "codemirror", "lightbox" ], "templates": [ "default", "blank" ], "languages": [ "cs", "en" ] }
安装器
默认:true
布尔值,指示是否从 CMS 存档中提取 install/ 目录。
注意
只有当 CMS 文件不存在时,安装器才会被提取。
命令
默认:[]
要添加到控制台的自定义命令映射。
示例
"commands": { "example.foo": { "class": "Example\\FooCommand" }, "example.bar": { "class": "Example\\BarCommand" } }
命令类必须扩展 SunlightConsole\Command
。
注意
有关支持的选项的完整列表,请参阅 src/Config/ServiceConfig.php。
来自其他包的命令
其他已安装的 Composer 包可以在它们的 composer.json 中以相同的方式定义命令。
在这种情况下,只读取 commands
选项,其他所有选项都将被忽略。
包可以具有除 "project" 之外的任何 类型。
is-fresh-project
默认:false
布尔值,表示这是一个新项目。
如果设置为 true
,下次下载 CMS 文件时,将对 composer.json 进行一些额外的更新。
- 名称、描述和许可证将被取消设置
- 将取消设置
is-fresh-project
选项 - 如果使用了 semver 版本约束(或“最新”)来定位 CMS 存档,则将自动将 cms.version 改为安装的版本号
用法
bin/console <command> [options] [args]
命令
控制台默认提供以下命令
(运行 bin/console
或 bin/console help
以显示有关可用命令的更多信息。)
backup.create create a backup cache.clear clear the cache cms.download download CMS files cms.info show information about the CMS cms.patch apply a patch to CMS files in the project config.create create config.php with default contents config.dump dump config.php contents config.set modify an option in config.php db.dump dump database db.import import a SQL dump db.query execute a SQL query log.monitor continuously print out log entries log.search search log entries plugin.action perform a plugin action (or list actions if no action is given) plugin.install install plugin from a ZIP file or an URL plugin.list list all plugins plugin.show show information about a plugin project.dump-config dump resolved project configuration user.reset-password reset password for the given user help show help
提示
您还可以将 --help
传递给任何命令以显示其帮助信息。
命令名称匹配
如果名称不模糊,则可以传递部分命令名称。
例如
bin/console ca.cl
将运行cache.clear
命令bin/console pl.s devkit
将运行plugin.show
命令