Skip to content

Commit

Permalink
Format epilogue.ts with prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-monteiro committed May 27, 2024
1 parent eabe4c8 commit a64bc29
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 90 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ Examples:
$ concurrently -P "npm:dev-* -- {@}" -- --watch --noEmit
# Results in something like: npm run dev-example -- --watch --noEmit
- Passthrough all additional arguments combined via '{*}' placeholder
- Passthrough all additional arguments combined into one argument via '{*}' placeholder
$ concurrently -P "echo {*}" -- foo bar
# Results in: echo 'foo bar'
Expand Down
186 changes: 97 additions & 89 deletions bin/epilogue.ts
Original file line number Diff line number Diff line change
@@ -1,98 +1,106 @@
// Add new examples here.
// Always start with `$ $0` so that it a) symbolizes a command line; and b) $0 gets replaced by the binary name uniformly.
const examples = [
{
description: 'Output nothing more than stdout+stderr of child processes',
example: '$ $0 --raw "npm run watch-less" "npm run watch-js"',
},
{
description: 'Normal output but without colors e.g. when logging to file',
example: '$ $0 --no-color "grunt watch" "http-server" > log',
},
{
description: 'Custom prefix',
example: '$ $0 --prefix "{time}-{pid}" "npm run watch" "http-server"',
},
{
description: 'Custom names and colored prefixes',
example:
'$ $0 --names "HTTP,WATCH" -c "bgBlue.bold,bgMagenta.bold" "http-server" "npm run watch"',
},
{
description: 'Auto varying colored prefixes',
example: '$ $0 -c "auto" "npm run watch" "http-server"',
},
{
description: 'Mixing auto and manual colored prefixes',
example: '$ $0 -c "red,auto" "npm run watch" "http-server" "echo hello"',
},
{
description: 'Configuring via environment variables with CONCURRENTLY_ prefix',
example:
'$ CONCURRENTLY_RAW=true CONCURRENTLY_KILL_OTHERS=true $0 "echo hello" "echo world"',
},
{
description: 'Send input to default',
example: [
'$ $0 --handle-input "nodemon" "npm run watch-js"',
'rs # Sends rs command to nodemon process',
].join('\n'),
},
{
description: 'Send input to specific child identified by index',
example: ['$ $0 --handle-input "npm run watch-js" nodemon', '1:rs'].join('\n'),
},
{
description: 'Send input to specific child identified by name',
example: ['$ $0 --handle-input -n js,srv "npm run watch-js" nodemon', 'srv:rs'].join('\n'),
},
{
description: 'Shortened NPM run commands',
example: '$ $0 npm:watch-node npm:watch-js npm:watch-css',
},
{
description: 'Shortened NPM run command with wildcard (make sure to wrap it in quotes!)',
example: '$ $0 "npm:watch-*"',
},
{
description:
'Exclude patterns so that between "lint:js" and "lint:fix:js", only "lint:js" is ran',
example: '$ $0 "npm:*(!fix)"',
},
{
description: "Passthrough some additional arguments via '{<number>}' placeholder",
example: [
'$ $0 -P "echo {1}" -- foo bar',
'# Results in: echo foo'
].join('\n'),
},
{
description: "Passthrough all additional arguments via '{@}' placeholder",
example: [
'$ $0 -P "npm:dev-* -- {@}" -- --watch --noEmit',
'# Results in something like: npm run dev-example -- --watch --noEmit'
].join('\n'),
},
{
description: "Passthrough all additional arguments combined via '{*}' placeholder",
example: [
'$ $0 -P "echo {*}" -- foo bar',
'# Results in: echo \'foo bar\''
].join('\n'),
},
{

Check failure on line 4 in bin/epilogue.ts

View workflow job for this annotation

GitHub Actions / Check

Insert `··`
description: "Output nothing more than stdout+stderr of child processes",

Check failure on line 5 in bin/epilogue.ts

View workflow job for this annotation

GitHub Actions / Check

Replace `····description:·"Output·nothing·more·than·stdout+stderr·of·child·processes"` with `········description:·'Output·nothing·more·than·stdout+stderr·of·child·processes'`
example: '$ $0 --raw "npm run watch-less" "npm run watch-js"',

Check failure on line 6 in bin/epilogue.ts

View workflow job for this annotation

GitHub Actions / Check

Insert `····`
},

Check failure on line 7 in bin/epilogue.ts

View workflow job for this annotation

GitHub Actions / Check

Insert `··`
{

Check failure on line 8 in bin/epilogue.ts

View workflow job for this annotation

GitHub Actions / Check

Insert `··`
description: "Normal output but without colors e.g. when logging to file",

Check failure on line 9 in bin/epilogue.ts

View workflow job for this annotation

GitHub Actions / Check

Replace `····description:·"Normal·output·but·without·colors·e.g.·when·logging·to·file"` with `········description:·'Normal·output·but·without·colors·e.g.·when·logging·to·file'`
example: '$ $0 --no-color "grunt watch" "http-server" > log',

Check failure on line 10 in bin/epilogue.ts

View workflow job for this annotation

GitHub Actions / Check

Insert `····`
},

Check failure on line 11 in bin/epilogue.ts

View workflow job for this annotation

GitHub Actions / Check

Replace `··` with `····`
{

Check failure on line 12 in bin/epilogue.ts

View workflow job for this annotation

GitHub Actions / Check

Replace `··` with `····`
description: "Custom prefix",

Check failure on line 13 in bin/epilogue.ts

View workflow job for this annotation

GitHub Actions / Check

Replace `····description:·"Custom·prefix"` with `········description:·'Custom·prefix'`
example: '$ $0 --prefix "{time}-{pid}" "npm run watch" "http-server"',
},
{
description: "Custom names and colored prefixes",
example:
'$ $0 --names "HTTP,WATCH" -c "bgBlue.bold,bgMagenta.bold" "http-server" "npm run watch"',
},
{
description: "Auto varying colored prefixes",
example: '$ $0 -c "auto" "npm run watch" "http-server"',
},
{
description: "Mixing auto and manual colored prefixes",
example: '$ $0 -c "red,auto" "npm run watch" "http-server" "echo hello"',
},
{
description:
"Configuring via environment variables with CONCURRENTLY_ prefix",
example:
'$ CONCURRENTLY_RAW=true CONCURRENTLY_KILL_OTHERS=true $0 "echo hello" "echo world"',
},
{
description: "Send input to default",
example: [
'$ $0 --handle-input "nodemon" "npm run watch-js"',
"rs # Sends rs command to nodemon process",
].join("\n"),
},
{
description: "Send input to specific child identified by index",
example: ['$ $0 --handle-input "npm run watch-js" nodemon', "1:rs"].join(
"\n"
),
},
{
description: "Send input to specific child identified by name",
example: [
'$ $0 --handle-input -n js,srv "npm run watch-js" nodemon',
"srv:rs",
].join("\n"),
},
{
description: "Shortened NPM run commands",
example: "$ $0 npm:watch-node npm:watch-js npm:watch-css",
},
{
description:
"Shortened NPM run command with wildcard (make sure to wrap it in quotes!)",
example: '$ $0 "npm:watch-*"',
},
{
description:
'Exclude patterns so that between "lint:js" and "lint:fix:js", only "lint:js" is ran',
example: '$ $0 "npm:*(!fix)"',
},
{
description:
"Passthrough some additional arguments via '{<number>}' placeholder",
example: ['$ $0 -P "echo {1}" -- foo bar', "# Results in: echo foo"].join(
"\n"
),
},
{
description: "Passthrough all additional arguments via '{@}' placeholder",
example: [
'$ $0 -P "npm:dev-* -- {@}" -- --watch --noEmit',
"# Results in something like: npm run dev-example -- --watch --noEmit",
].join("\n"),
},
{
description:
"Passthrough all additional arguments combined into one argument via '{*}' placeholder",
example: [
'$ $0 -P "echo {*}" -- foo bar',
"# Results in: echo 'foo bar'",
].join("\n"),
},
];

const examplesString = examples
.map(({ example, description }) =>
[
` - ${description}`,
example
.split('\n')
.map((line) => ` ${line}`)
.join('\n'),
].join('\n\n'),
)
.join('\n\n');
.map(({ example, description }) =>
[
` - ${description}`,
example
.split("\n")
.map((line) => ` ${line}`)
.join("\n"),
].join("\n\n")
)
.join("\n\n");

export const epilogue = `
Examples:
Expand Down

0 comments on commit a64bc29

Please sign in to comment.