26 releases

0.1.9 Apr 6, 2024
0.1.8 Mar 22, 2024
0.1.2 Feb 29, 2024
0.0.17 Feb 29, 2024
0.0.1 Sep 27, 2022

#74 in #cli-command

Download history 712/week @ 2024-02-23 983/week @ 2024-03-01 262/week @ 2024-03-08 53/week @ 2024-03-15 142/week @ 2024-03-22 24/week @ 2024-03-29 136/week @ 2024-04-05

359 downloads per month

MIT license

2.5MB
286 lines

Contains (DOS exe, 1MB) target/release/Innkeeper.exe, (DOS exe, 1MB) target/release/Inn.exe

🍺 Inn

Inn is a command-line tool designed to execute a specified command in all directories that match a certain pattern within a given root directory. It provides flexibility and efficiency in running commands across multiple directories with customizable patterns.

Benchmark

Command: Time:
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

Installation

cargo install innkeeper

Usage

Inn .git git fetch upstream

This command will fetch from upstream for all the .git repositories inside the current directory. Basically, it replaces the following command:

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

You can hide the command output by specifying an -H or --Hide parameter:

Inn -H -F package.json ncu -u

To specify a --File argument or -F, if you would like to search for a file instead of a directory, use:

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

Additionally, you can provide a --Root argument or -R to set the current working directory to a different folder. The default is ..

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

Specify a --Parallel argument or -P if you would like to run commands in parallel. The default is sequential.

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

Dependencies

The code imports several crates:

  • clap - For parsing command-line arguments.
  • tokio - Enables parallel execution of tasks.
  • walkdir - Facilitates filesystem traversal.

Changelog

See CHANGELOG.md for a history of changes to this CLI.

Dependencies

~4–12MB
~95K SLoC