#command #parallel #directories #execute-command #multiple #lets #pattern

已删除 inn2

🍺 INN2 允许您在多个目录中并行执行命令

2 个版本

0.1.6 2024年3月4日
0.0.2 2024年3月4日
0.0.1 2024年3月4日

#23#lets

每月23次 下载

MIT 许可证

1MB
283

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

🍺 Inn2

Inn2 是一个命令行工具,旨在在给定根目录内匹配特定模式的所有目录中执行指定命令。它提供灵活性和效率,以便通过可自定义的模式在多个目录中运行命令。

基准测试

命令 时间
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

此命令将从上游获取当前目录内所有 .git 仓库的内容。实质上,它替换了以下shell命令

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

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

Inn -F astro.config.ts npx astro add astro-compress

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

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

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

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

依赖项

代码导入了几个crate

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

变更日志

有关此 CLI 的变更历史,请参阅 CHANGELOG.md

依赖项

~4–12MB
~129K SLoC