xcman
是一个用 Swift 编写的命令行工具,用于管理 Xcode 文件模板和代码片段。
从这里移动
$ git clone https://github.com/me/my-templates.git
$ cd my-templates
$ ./install
zsh: permission denied: ./install
$ chmod +x ./install
$ ./install
到这里
$ xcman templates install me/my-templates
$ brew tap josefdolezal/formulae
$ brew install xcman
$ git clone https://github.com/josefdolezal/xcman.git
$ cd xcman
$ swift build
xcman
支持管理文件模板和代码片段。 这些功能通过 templates
和 snippets
子命令进行命名空间划分。 运行该工具时,使用 --help
选项查看文档。
模板是通过在您的主目录中使用缓存的 git 仓库进行管理的。 对于每个已安装的模板组,将在 Xcode 模板目录中创建一个新文件夹。 这个新文件夹包含指向您提取的 git 文件夹的链接。
支持的命令
install (安装)
$ xcman templates install [--use-url] [--name <name>] <repo>
将模板从给定的仓库安装到 Xcode。 默认情况下,给定的仓库被解释为 GitHub 句柄。 如果你想从其他来源安装,使用 --use-url
标志。 在 Xcode 中可见的模板组名称可以使用 --name
选项进行配置。
示例
# Install templates from GitHub repository with custom group name
$ xcman templates install --name "My Templates" me/my-templates
# Install templates from arbitrary url
$ xcman templates install --use-url https://gitlab.com/company/repo.git
list (列表)
$ xcman templates list
列出所有已安装的模板组。
remove (移除)
$ xcman templates remove <group>
从 Xcode 中移除给定的模板组。
代码片段的管理方式与文件模板类似,使用您主目录中的仓库缓存。 Xcode 目前不支持代码片段的结构化格式,因此文件系统结构是扁平的。
install (安装)
$ xcman snippets install [--use-url] <repo>
从给定的 GitHub 仓库安装模板。 默认情况下,仓库参数被解释为 GitHub 句柄。 使用 --use-url
从任意 git 仓库安装模板。
该工具基于以下依赖项构建
本仓库使用 MIT 许可。