open-cli-tools / open-cli-tools/concurrently

Add CLI support for command templates/matrix commands

Open
#517 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pull request welcome
Dominant language
TypeScript
Stars
7.9k
Forks
281
Avg merge
17h 12m
Merged PRs (30d)
1

Description

It would be useful to be able to generate the commands dynamically based on an environment variable. For example:

concurrently --matrix "A B C" "echo {}"

Which would be equivalent to typing:

concurrently "echo A" "echo B" "echo C"

Or with multiple values you could do:

concurrently --matrix "A B C" --matrix "1 2 3" "echo {1}{2}"

Which would be equivalent to writing:

concurrently "echo A1" "echo "A2" "echo A3" "echo B1" "echo B2" "echo B3" "echo C1" "echo C2" "echo C3"

This would be useful for common repetitive tasks that can happen in parallel. For example, let's say I want to download some docker image on a few different servers. I could do:

SERVERS="server1 server2"
IMAGES="python:3.11 node:20"

concurrently --group --matrix "$SERVERS" --matrix "$IMAGES" "ssh {1} 'docker pull {2}'"

This would help making concurrently a drop-in replacement for bash for-loops; the above would replace

for server in $SERVERS; do
    for image in $IMAGES; do
        ssh $server "docker pull $image"
    done
done

It would also make concurrently a drop-in for a lot of gnu parallel usages, eg:

parallel --quote ssh {1} "docker pull {2}" ::: $SERVERS ::: $IMAGES

Another example: processing a lot files in parallel, eg less compiling a number of files:

concurrently --matrix "$(ls *.less)" --group "lessc {}"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the issue's --matrix command examples and compare the requested behavior with the existing concurrently CLI entry point. Define how multiple matrices, placeholders, quoting, and empty values should behave; done means the documented examples expand into the expected commands and the feature is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell, typescript
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.