5 个不稳定版本

新增 0.3.0 2024 年 8 月 15 日
0.2.2 2024 年 5 月 21 日
0.2.1 2024 年 4 月 11 日
0.2.0 2024 年 3 月 26 日
0.1.0 2024 年 2 月 18 日

#185操作系统

Download history · Rust 包仓库 159/week @ 2024-05-20 · Rust 包仓库 3/week @ 2024-05-27 · Rust 包仓库 8/week @ 2024-07-01 · Rust 包仓库 5/week @ 2024-07-29 · Rust 包仓库 115/week @ 2024-08-12 · Rust 包仓库

每月 120 次下载

MIT 许可证

65KB
1.5K SLoC

Together

一个通过交互式提示符选择性地并行运行多个命令的工具。受 concurrently 启发。

Crates.io MIT licensed Build Status

安装

安装 together 最简单的方法是使用 cargo。如果您还没有安装 cargo,可以按照 Rust 官方网站 上的说明进行安装。

cargo install together-rs

另外,together 可以使用您平台上的预构建二进制文件进行安装。您可以在 发布页面 上找到最新版本。下载您平台的二进制文件并将其添加到您的 PATH 中。

# For example, on macOS
curl -L https://github.com/michaelblawrence/together-rs/releases/download/0.3.0/together-rs_0.3.0_x86_64-apple-darwin.zip -o together.zip
unzip together.zip
mv together /usr/local/bin

使用方法

入门

启动交互式提示符

together run -- "echo 'hello'" "echo 'world'"

这允许您选择要并行运行的命令。

并行运行所有命令

together run --all -- "echo 'hello'" "echo 'world'"

示例

以下示例中,我们使用 yarn workspace 来运行多个 package.json 脚本,将 stdout/stderr 前置到终端

together run --raw -- \
 "yarn workspace server dev" \
 "yarn workspace client dev" \
 "yarn workspace event-processor dev" \
 "yarn workspace api-types watch"

运行上述命令将启动 together,您将看到以下交互式提示符

image

您可以通过按 空格键 切换选择。按 enter 键开始选定的命令。

together 与单仓库(monorepo)配合良好,允许您在同一终端窗口中运行所有必需的可执行文件。

需要终止或重启单个命令?在运行 together 时按任意时间 ? 键,以查看管理命令的选项(见下文)。

管理命令

当交互式提示符正在运行时,您可以通过按下以下键来管理命令(在 together 运行时)

  • t:触发另一个命令启动
  • k:终止正在运行的命令
  • r:重启正在运行的命令
  • h?:显示帮助信息,并列出所有正在运行的命令,以及更多交互式选项

配置

每次运行 together 时,它都会将配置保存到本地磁盘。

您可以使用 together load [toml_path] 选项来指定要使用的配置文件。或者使用以下命令以最后保存的配置启动 together

together rerun

贡献

如果您有兴趣为项目做出贡献,您可以首先通过克隆仓库并构建项目开始

git clone https://github.com/michaelblawrence/together-rs.git
cd together
cargo build

请遵循标准的 Rust 社区指南,并在我们的仓库上提交 PR。

许可证

本项目采用 MIT 许可证 - 有关详细信息,请参阅 LICENSE 文件。

依赖项

~4–12MB
~131K SLoC