26 个版本

0.1.9 2024年4月6日
0.1.8 2024年3月22日
0.1.2 2024年2月29日
0.0.17 2024年2月29日
0.0.1 2022年9月27日

#80#cli-command

Download history 9/week @ 2024-06-26 167/week @ 2024-07-03 65/week @ 2024-07-24 20/week @ 2024-07-31

每月 85 次下载

MIT 许可证

2.5MB
286 代码行

包含 (DOS 可执行文件, 1MB) target/release/Innkeeper.exe,(DOS 可执行文件, 1MB) target/release/Inn.exe

🍺 Inn

Inn 是一个命令行工具,旨在在给定根目录内匹配特定模式的目录中执行指定的命令。它提供了运行跨多个目录的命令的灵活性和效率,并允许自定义模式。

基准测试

命令 时间
Inn -P .git ls
real    0m9.441s
user    0m0.030s
sys     0m0.046s
find -iname .git -type d -execdir ls \;
real    0m14.293s +5s
user    0m4.645s +4s
sys     0m8.937s +8s
Inn -P .git git status
real    0m24.146s
user    0m0.030s
sys     0m0.062s
find -iname .git -type d -execdir ls \;
real    0m28.584s +4s
user    0m4.695s +4s
sys     0m8.354s +8s
Inn -P .git 'git add . && git commit -m "squash!" && git sync'
real    0m33.813s
user    0m0.015s
sys     0m0.060s
find -iname .git -type d -execdir \
bash -c 'git add . && git commit -m "squash!" && git sync' \;
real    0m53.122s +20s
user    0m9.449s +9s
sys     0m14.442s +14s

安装

cargo install innkeeper

使用

Inn .git git fetch upstream

此命令将从当前目录内的所有 upstream 克隆 .git 仓库。基本上,它替换了以下命令

find -iname .git -type d -execdir git fetch upstream \;

您可以通过指定 -H--Hide 参数来隐藏命令输出

Inn -H -F package.json ncu -u

如果您想搜索文件而不是目录,可以使用指定 --File 参数或 -F

Inn -F astro.config.ts npx astro add @playform/compress

此外,您还可以提供 --Root 参数或 -R 将当前工作目录设置为不同的文件夹。默认为 .

Inn -R D:\Developer .git git fetch upstream

如果您想并行运行命令,请指定 --Parallel 参数或 -P。默认为顺序执行。

Inn -P -R D:\Developer .git git fetch upstream

依赖项

代码导入几个crates

  • clap - 用于解析命令行参数。
  • tokio - 启用任务的并行执行。
  • walkdir - 便于文件系统遍历。

变更日志

查看 CHANGELOG.md 了解此 CLI 的变更历史。

依赖项

~4–12MB
~126K SLoC