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:
|
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:
Include Specific Directories
Execute a command only in specified directories:
Exclude Directories
Execute a command in all subdirectories except specified ones:
Use Patterns
Include directories matching a pattern:
Exclude directories matching a pattern:
Initialize Configuration
Create a .looprc
configuration file in your current directory:
The above will create a .looprc
file in your current directory similar to the following:
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
- Update all Git repositories:
- Run tests in all JavaScript projects:
- Clean build artifacts in C++ projects:
- Update dependencies in Python projects:
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.