prun 0.1.3

๐Ÿบโ€Runโ€โ€”
Documentation
prun-0.1.3 has been yanked.

๐Ÿบโ€Runโ€โ€”

Run is a command-line tool that executes commands in multiple directories concurrently.

Bench

๐Ÿš€ Installation

cargo install prun

๐Ÿ› ๏ธ Usage

Run can be used with various options:

๐Ÿบโ€Runโ€โ€”

Usage: Run [OPTIONS] --Command <COMMAND> <PATTERN>

Arguments:
  <PATTERN>  ๐Ÿ”โ€Patternโ€โ€” [default: .]

Options:
  -F, --File               ๐Ÿ“โ€Fileโ€โ€”
  -P, --Parallel           โฉโ€Parallelโ€โ€”
  -R, --Root <ROOT>        ๐Ÿ“‚โ€Rootโ€โ€” [default: .]
  -E, --Exclude <EXCLUDE>  ๐Ÿšซโ€Excludeโ€โ€” [default: "node_modules .git target dist vendor"]
  -C, --Command <COMMAND>  ๐Ÿ–ฅ๏ธโ€Commandโ€โ€”
  -h, --help               Print help
  -V, --version            Print version
Run .git -C 'git fetch upstream'

This command will fetch from upstream for all .git repositories inside the current directory. It essentially replaces the following command:

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

Options

--Command or -C:

The command to execute:

Run .git -C 'git status'

or multiple commands:

Run .git -C 'git status' -C 'git add .' -C 'git commit'

--File or -F:

Limit execution to files matching a certain pattern:

Run -F astro.config.ts -C 'npx astro add @playform/compress'

--Root or -R:

Set the current working directory to a different folder (default is .):

Run -R D:\Developer .git -C 'git fetch upstream'

--Parallel or -P:

Run commands in parallel (default is sequential):

Run -P -R D:\Developer .git -C 'git fetch upstream'

--Exclude:

Exclude certain files or directories (defailt is node_modules .git target dist vendor)

--Pattern:

Specify a custom pattern for matching

Dependencies

Run relies on several Rust crates to provide its functionality:

  • clap (v4.5.17) - A powerful and flexible command-line argument parser. The "derive" feature is used to simplify the creation of command-line interfaces through derive macros.

  • walkdir (v2.5.0) - Provides an efficient and cross-platform way to recursively traverse directories. This is useful for filesystem operations and searching.

  • futures (v0.3.30) - Offers abstractions for asynchronous programming in Rust. It's used in conjunction with tokio to handle asynchronous operations effectively.

  • rayon (v1.10.0) - Enables easy parallelism for data-parallel tasks. It's used to parallelize CPU-bound operations, improving performance on multi-core systems.

  • tokio (v1.40.0) - An asynchronous runtime for Rust, providing essential building blocks for writing reliable asynchronous applications. The "full" feature set is used to enable all tokio functionality.

  • num_cpus (v1.16.0) - A small crate that determines the number of CPUs on the current system. This is useful for optimizing parallel workloads.

  • once_cell (v1.19.0) - Provides a way to perform lazy static initialization. It's often used for global variables or singletons that need to be initialized only once.

These dependencies work together to provide a robust, efficient, and user-friendly command-line tool capable of handling parallel and asynchronous operations while efficiently traversing filesystems.

Changelog

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