parallel-sh
v1.1.2
Published
Run multiple commands in parallel with pretty Docker-like output
Maintainers
Readme
parallel-sh
Run multiple shell commands in parallel with pretty, Docker-like output. No third-party dependencies required.
Features
- Run multiple commands in parallel
- Colorful, prefixed output for each command
- Supports config file or direct command-line input
- Graceful shutdown on Ctrl+C
- No third-party dependencies
Installation
You can run directly with npx (no install needed):
npx parallel-sh --commands 'cd frontend && npm run dev; cd backend && npm run dev'Or install globally:
npm install -g parallel-sh
parallel-sh --commands 'cd frontend && npm run dev; cd backend && npm run dev'Or locally in your project:
npm install parallel-sh --save-dev
npx parallel-sh --commands 'cd frontend && npm run dev; cd backend && npm run dev'Usage
Command-line Options
--commands <cmds>: Pass semicolon-separated shell commands to run in parallel.--config <file>: Use a JSON configuration file specifying commands to run.--minLength <number>: Minimum width for the service name column (default: 4).--maxLength <number>: Maximum width for the service name column (default: 12).--help: Show help message and usage examples.
Examples
Run commands directly
npx parallel-sh --commands 'cd frontend && npm run dev; cd backend && npm run start:dev'Using a config file
Create a file (e.g., commands.json):
{
"minLength": 6,
"maxLength": 16,
"commands": [
{
"name": "frontend",
"command": "npm run dev",
"cwd": "./frontend"
},
{
"name": "backend",
"command": "npm run start:dev",
"cwd": "./backend"
}
]
}Then run:
npx parallel-sh --config commands.jsonShow help
npx parallel-sh --helpminLength and maxLength
You can control the minimum and maximum width of the service name column in the output using --minLength and --maxLength (CLI) or minLength and maxLength (config file).
minLength: Minimum width for the service name column (default: 4)maxLength: Maximum width for the service name column (default: 12)
Example:
npx parallel-sh --commands 'echo frontend; echo backend' --minLength 8 --maxLength 20Or in your config file:
{
"minLength": 8,
"maxLength": 20,
"commands": [ ... ]
}License
MIT
