loop_cmd

Crates.ioloop_cmd
lib.rsloop_cmd
version0.1.16
sourcesrc
created_at2024-07-25 03:25:41.218332
updated_at2024-07-25 03:25:41.218332
descriptionA command-line tool for executing commands across multiple directories
homepagehttps://github.com/mateodelnorte/loop_cmd
repositoryhttps://github.com/mateodelnorte/loop_cmd
max_upload_size
id1314631
size60,284
Matt Walters (mateodelnorte)

documentation

https://github.com/mateodelnorte/loop_cmd

README

loop / loop_cmd

loop is a simple, but powerful command-line tool that allows you to execute commands in multiple directories simultaneously. It's designed to simplify batch operations across multiple projects or subdirectories, making it an essential tool for developers managing complex project structures.

Features

  • Execute commands in child directories
  • Include or exclude specific directories
  • Use patterns to filter directories
  • Initialize configuration file

Installation

You can install loop using the following command:

curl -fsSL https://raw.githubusercontent.com/mateodelnorte/loop_cmd/main/install.sh | sh

This will download and install loop so that it can be used as a command from your PATH.

Usage

Basic Usage

Execute a command in all immediate subdirectories:

loop "git status"

Include Specific Directories

Execute a command only in specified directories:

loop "npm install" --include dir1 dir2

Exclude Directories

Execute a command in all subdirectories except specified ones:

loop "cargo build" --exclude target node_modules

Use Patterns

Include directories matching a pattern:

loop "yarn test" --include-pattern "app-"

Exclude directories matching a pattern:

loop "make clean" --exclude-pattern "-old"

Initialize Configuration

Create a .looprc configuration file in your current directory:

loop --init

The above will create a .looprc file in your current directory similar to the following:

{
  "ignore": [
    ".git"
  ]
}

This file can be used to set default options for the loop command. The above file, for instance, will automatically apply --ignore .git .vagrant .vscode target to all commands run using loop within the directory containing the file.

Configuration

You can create a .looprc file in your current directory to set default options. Use loop --init to create a template configuration file.

Examples

  1. Update all Git repositories:
loop "git pull origin main"
  1. Run tests in all JavaScript projects:
loop "npm test" --include-pattern "*-js"
  1. Clean build artifacts in C++ projects:
loop "make clean" --exclude build node_modules
  1. Update dependencies in Python projects:
loop "pip install -r requirements.txt --upgrade" --include-pattern "py-*"

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License

Commit count: 0

cargo fmt