Given the following code:
const cloneRepo = async (repo: string): Promise<void> => {
await spawn(
'git',
['clone', `git@github.com:popsql/${repo}.git`, repo],
{ captureOutput: true, pipeOutput: true },
);
}
const cloneRepos = async (): Promise<void> => {
await Promise.all([
cloneRepo('foo'),
cloneRepo('bar'),
cloneRepo('baz'),
]);
};
Each clone operation runs in parallel, and so their output gets mingled like so:
remote: Enumerating objects: 408, done.
remote: Counting objects: 100% (408/408), done.
remote: Compressing objects: 100% (260/260), done.
remote: Enumerating objects: 584, done.
remote: Enumerating objects: 24412, done.
remote: Counting objects: 100% (2094/2094), done.
remote: Counting objects: 100% (584/584), done.
remote: Compressing objects: 100% (277/277), done.
remote: Compressing objects: 100% (221/221), done.
remote: Enumerating objects: 9583, done.
remote: Enumerating objects: 49959, done.
remote: Counting objects: 100% (2834/2834), done.
remote: Counting objects: 100% (9240/9240), done.
remote: Total 408 (delta 238), reused 302 (delta 140), pack-reused 0
Receiving objects: 100% (408/408), 257.02 KiB | 446.00 KiB/s, done.
Resolving deltas: 100% (238/238), done.
# goes on
There's no way to know what repo is currently being operated on, and so makes the output somewhat pointless. It would be nice, similar to docker-compose, to allow appending a prefix to each output line, such that would get something like:
foo: remote: Enumerating objects: 408, done.
foo: remote: Counting objects: 100% (408/408), done.
foo: remote: Compressing objects: 100% (260/260), done.
bar: remote: Enumerating objects: 584, done.
baz: remote: Enumerating objects: 24412, done.
bar: remote: Counting objects: 100% (2094/2094), done.
baz: remote: Counting objects: 100% (584/584), done.
bar: remote: Compressing objects: 100% (277/277), done.
baz: remote: Compressing objects: 100% (221/221), done.
bar: remote: Enumerating objects: 9583, done.
baz: remote: Enumerating objects: 49959, done.
bar: remote: Counting objects: 100% (2834/2834), done.
baz: remote: Counting objects: 100% (9240/9240), done.
bar: remote: Total 408 (delta 238), reused 302 (delta 140), pack-reused 0
foo: Receiving objects: 100% (408/408), 257.02 KiB | 446.00 KiB/s, done.
foo: Resolving deltas: 100% (238/238), done.
# goes on
Given the following code:
Each clone operation runs in parallel, and so their output gets mingled like so:
There's no way to know what repo is currently being operated on, and so makes the output somewhat pointless. It would be nice, similar to
docker-compose, to allow appending a prefix to each output line, such that would get something like: