Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new --matrix option to multiply commands #526

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cdrini
Copy link
Contributor

@cdrini cdrini commented Jan 16, 2025

Closes #517

Sample runs:

Single dimension:

$ dist/bin/concurrently.js --group --matrix 'A B C' 'echo {1}'
[0] A
[0] echo A exited with code 0
[1] B
[1] echo B exited with code 0
[2] C
[2] echo C exited with code 0

Multiple dimensions:

$ dist/bin/concurrently.js --group --matrix 'A B' --matrix '1 2' 'echo {1}{2}'
[0] A1
[0] echo A1 exited with code 0
[1] A2
[1] echo A2 exited with code 0
[2] B1
[2] echo B1 exited with code 0
[3] B2
[3] echo B2 exited with code 0

With environment variables:

$ SERVERS="$(echo ol-web{0..2})"
$ IMAGES="python:3.12-slim python:3.13-slim"
$ dist/bin/concurrently.js --group --matrix "$SERVERS" --matrix "$IMAGES" 'ssh {1} docker image pull {2}'
[0] 3.12-slim: Pulling from library/python
[0] af302e5c37e9: Pulling fs layer
[0] 499051ac08b3: Pulling fs layer
...
[0] bc54bb88b02b: Pull complete
[0] Digest: sha256:123be5684f39d8476e64f47a5fddf38f5e9d839baff5c023c815ae5bdfae0df7
[0] Status: Downloaded newer image for python:3.12-slim
[0] docker.io/library/python:3.12-slim
[0] ssh ol-web0 docker image pull python\:3.12-slim exited with code 0
[1] 3.13-slim: Pulling from library/python
[1] af302e5c37e9: Pulling fs layer
[1] 31fc40b7245b: Pulling fs layer
...
[1] e81d26d6c5a7: Pull complete
[1] Digest: sha256:23a81be7b258c8f516f7a60e80943cace4350deb8204cf107c7993e343610d47
[1] Status: Downloaded newer image for python:3.13-slim
[1] docker.io/library/python:3.13-slim
[1] ssh ol-web0 docker image pull python\:3.13-slim exited with code 0
[2] 3.12-slim: Pulling from library/python
[2] af302e5c37e9: Pulling fs layer
...

@cdrini cdrini force-pushed the 517/feature/matrix-option branch from ecdae50 to 5af7c99 Compare January 16, 2025 01:56
@coveralls
Copy link

Coverage Status

coverage: 98.032% (-0.1%) from 98.18%
when pulling ecdae50 on cdrini:517/feature/matrix-option
into 7f3efb2 on open-cli-tools:main.

@cdrini cdrini force-pushed the 517/feature/matrix-option branch from 5af7c99 to dfc3c5f Compare January 16, 2025 01:57
@cdrini cdrini force-pushed the 517/feature/matrix-option branch from dfc3c5f to f656f5d Compare January 16, 2025 02:16
@cdrini cdrini marked this pull request as ready for review January 16, 2025 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add CLI support for command templates/matrix commands
2 participants