# 命令运行器 just just 提供一种保存和运行项目命令的便捷方式 ## 概述 类似 make 或者 npm 配置命令。 just 为其中的运行项目命令功能。 ![just](https://cdn.ftls.xyz/images/2023/12/just.jpg) just 应该可以在任何有合适的 sh 的系统上运行,包括 Linux、MacOS 和 BSD。在 Windows 上,just 可以使用 PowerShell 。 - 官网 https://just.systems/ - 用户指南 https://just.systems/man/zh/ ## 简单使用 在 https://just.systems/man/zh/chapter_4.html 找对应平台的二进制文件,或者 apt pacman cargo 等方式下载安装 项目根目录创建一个名为 justfile 的文件 ```sh recipe-name: echo 'This is a recipe!' # 这是一行注释 another-recipe: @echo 'This is another recipe.' ``` 终端运行 ```sh $ just echo 'This is a recipe!' This is a recipe! $ just another-recipe This is another recipe. ``` 更多见文档 https://just.systems/man/zh/chapter_18.html ## 异同 研究了一下 Just 与 Taskfile 异同,总得来说两个都以 make 为榜样。Just 仅仅为任务运行,强化了多语言执行;Taskfile 则为运行与构建,强化构建。感官上,Just 很容易上手,看了几行说明就可以开始用了,很好理解;Task 复杂一些,我大概会在需要构建多平台,在多级目录,无检查变动的编译构建时使用,比如 npm build 。最后 Just 星多一些 小白选 just 就行了 ## 替代方案 https://just.systems/man/zh/chapter_67.html 现在并不缺少命令运行器!在这里,有一些或多或少比较类似于 `just` 的替代方案,包括: - [make](https://en.wikipedia.org/wiki/Make_(software)): 启发了 `just` 的 Unix 构建工具。最初的 `make` 有几个不同的现代后裔, 包括 [FreeBSD Make](https://www.freebsd.org/cgi/man.cgi?make(1)) 和 [GNU Make](https://www.gnu.org/software/make/)。 - [task](https://github.com/go-task/task): 一个用 Go 编写的基于 YAML 的命令运行器。 - [maid](https://github.com/egoist/maid): 一个用 JavaScript 编写的基于 Markdown 的命令运行器。 - [microsoft/just](https://github.com/microsoft/just): 一个用 JavaScript 编写的基于 JavasScript 的命令运行器。 - [cargo-make](https://github.com/sagiegurari/cargo-make): 一个用于 Rust 项目的命令运行器。 - [mmake](https://github.com/tj/mmake): 一个针对 `make` 的包装器,有很多改进,包括远程包含。 - [robo](https://github.com/tj/robo): 一个用 Go 编写的基于 YAML 的命令运行器。 - [mask](https://github.com/jakedeichert/mask): 一个用 Rust 编写的基于 Markdown 的命令运行器。 - [makesure](https://github.com/xonixx/makesure): 一个用 AWK 和 Shell 编写的简单而便携的命令运行器。 - [haku](https://github.com/VladimirMarkelov/haku): 一个用 Rust 编写的类似 make 的命令运行器。