electrikmilk/cherri
GitHub: electrikmilk/cherri
一门用类 Go 语法编写并编译为 Siri Shortcuts 的编程语言,让复杂的快捷指令开发变得可维护、可版本控制。
Stars: 1281 | Forks: 46
# Cherri
[](https://github.com/electrikmilk/cherri/actions/workflows/build-test.yml)
[](https://github.com/electrikmilk/cherri/releases)
[](https://github.com/electrikmilk/cherri/blob/main/go.mod)
[](https://github.com/electrikmilk/cherri/blob/main/LICENSE)

[](https://pkg.go.dev/github.com/electrikmilk/cherri?tab=doc)
[](https://goreportcard.com/report/github.com/electrikmilk/cherri)
**Cherri**(读音同 cherry)是一种 [Shortcuts](https://apps.apple.com/us/app/shortcuts/id1462947752) 编程语言,可直接编译为有效且可运行的 Shortcut。
首要目标是在(Shortcuts 的限制范围内)切实可行地创建大型 Shortcut 项目并对其进行长期维护。
[](https://playground.cherrilang.org)
### 🌟 主要特性
- 🖥️ 基于笔记本电脑/台式机的开发(CLI、[VSCode 扩展](https://marketplace.visualstudio.com/items?itemName=electrikmilk.cherri-vscode-extension)、macOS 应用程序)
- 🎓 易于学习,语法与其他语言类似
- 🐞 尽可能 1:1 转换为 Shortcut 操作,使调试更容易
- 🥾 半自举:大多数操作和类型是用该语言本身编写的
- 💻 在 Mac 上导入操作
- 📦 包管理器:内置基于远程 Git 仓库的包管理器,允许自动包含和更新
- 🪄 没有魔法变量语法,它们是常量
- 🪶 经过优化,可创建尽可能小的 Shortcut 并减少运行时的内存使用
- #️⃣ 在其他文件中包含文件,用于大型 Shortcut 项目
- 🔧 定义具有类型检查、枚举、可选项、默认值、原始标识符和原始键的操作
- 🔄 定义函数以便在 Shortcut 顶部的自身作用域内运行,以减少重复操作
- 📋 自动复制粘贴操作
- 🥩 使用 Raw Actions 手动输入操作标识符和参数
- ❓ 定义导入问题
- 📇 为菜单生成 VCard
- 📄 以 base64 格式嵌入文件
- 🔀 使用 `--import=` 选项从 iCloud 链接转换 Shortcuts
- 🔢 类型系统和类型推断
- 🔏 使用 macOS 签名,回退到 [HubSign](https://routinehub.co/membership) 或其他使用 [scaxyz/shortcut-signing-server](https://github.com/scaxyz/shortcut-signing-server) 的服务器
### 资源
- 🍒 [Cherri VSCode Extension](https://marketplace.visualstudio.com/items?itemName=electrikmilk.cherri-vscode-extension)
- 🛝 [Playground](https://playground.cherrilang.org/) - 在任何平台上试用 Cherri,预览结果并导出已签名的 Shortcuts
- 🖥️ [macOS IDE](https://github.com/electrikmilk/cherri-macos-app) - 定义 Cherri 文件类型,在 Mac 上使用 GUI 编写和构建 Shortcuts
- 📄 [Documentation](https://cherrilang.org/language/) - 学习 Cherri 或如何贡献
- 🔍 [Glyph Search](https://glyphs.cherrilang.org/) - 搜索你可以在 Cherri 中使用的字形!
- ❓ [FAQ](https://cherrilang.org/faq)
## 安装说明
您可以通过下载最新版本或通过 Homebrew 或 Nix 包管理器来安装 Cherri:
### 通过 Homebrew 安装
如果您已安装 Homebrew,可以运行:
**添加 Tap:**
```
brew tap electrikmilk/cherri
```
**安装:**
```
brew install electrikmilk/cherri/cherri
```
### 通过 Nix 安装
如果您已安装 Nix,可以运行:
```
nix profile install github:electrikmilk/cherri
```
或者,您可以使用 `nix-direnv` 获得一个隔离的、[轻松的开发环境](https://determinate.systems/blog/nix-direnv/),根据您所在的目录,`cherri` 将可用。然后您将使用 use_flake 并将 Cherri 添加到 flake.nix:
```
{
inputs.cherri.url = "github:electrikmilk/cherri";
{ # outputs.packages.${system}.default = pkgs.mkShell etc - omitted for brevity
buildInputs = [
inputs.cherri.packages.${system}.cherri
]
}
}
```
然后在包含 flake.nix 文件的目录中运行 `direnv allow`。
## 使用方法
```
cherri file.cherri
```
运行不带任何参数的 `cherri` 以查看所有选项和用法。出于开发目的,使用 `--debug`(或 `-d`)选项打印堆栈跟踪、调试信息并输出 `.plist` 文件。
## 为什么会有另一种 Shortcuts 语言?
因为很有趣 :)
有些语言已经被废弃、运行不佳或不再工作。我不希望 Shortcuts 语言消亡。
应该更多,而不是更少。
此外,该项目基于 macOS 而非 iOS,带来了一些稳定性,而且除了 [Buttermilk](https://github.com/zachary7829/Buttermilk) 之外,我不知道还有其他以 macOS 为平台的 Shortcuts 语言。
### 参考
- [zachary7829/Shortcuts File Format Documentation](https://zachary7829.github.io/blog/shortcuts/fileformat)
- [sebj/iOS-Shortcuts-Reference](https://github.com/sebj/iOS-Shortcuts-Reference)
- [[Tip] Reducing memory usage of repeat loops](https://www.reddit.com/r/shortcuts/comments/taceg7/tip_reducing_memory_usage_of_repeat_loops/)
### 灵感
- Go 语法
- Ruby 语法
- [ScPL](https://github.com/pfgithub/scpl)
- [Buttermilk](https://github.com/zachary7829/Buttermilk)
- [Jelly](https://jellycuts.com)
_最初的 Workflow 应用程序为每个版本分配了一个代号。Cherri 是以倒数第二次更新“Cherries”命名的(而且樱桃也是我最喜欢的口味之一)。_
该项目始于 2022 年 10 月 5 日。标签:Apple生态, Cherri, EVTX分析, Go语言, iOS快捷指令, Shortcuts, SOC Prime, VSCode插件, 云资产清单, 包管理器, 开发工具, 日志审计, 程序破解, 统一API, 编程语言, 编译器, 网络调试, 脚本语言, 自动化, 逆向工程