open-cli-tools / concurrently

Run commands concurrently. Like `npm run watch-js & npm run watch-less` but better.
https://www.npmjs.com/package/concurrently
MIT License
7k stars 228 forks source link

Add a --fix-name-length option to align command output #417

Closed syabro closed 1 month ago

syabro commented 1 year ago

When using concurrently, providing custom names with the -n or --names option can cause output to become misaligned and difficult to read if the names have different lengths. This can be particularly problematic when the output is lengthy and spans multiple lines.

To address this issue, I propose adding a new --fix-name-length option that allows users to specify a fixed length for the command names. When this option is used, the command names will be padded with spaces or truncated as necessary to ensure that they all have the same length, and the output will be properly aligned.

For example, if a user runs the following command:

concurrently -n "API, TypeScript, VeryLong" --fix-name-length\
    "npm run api" "npm run typescript" "npm run somethingverylong"

The output would be aligned like this:

API        | output from npm run api
TypeScript | output from npm run typescript
VeryLong   | output from npm run somethingverylong

This would make it much easier to read and understand the output from each command, especially in cases where the output spans multiple lines.

I believe that adding a --fix-name-length option would be a valuable addition to concurrently, as it would improve the user experience for those who use custom names for their commands.

gustavohenke commented 1 year ago

I like this idea very much!

With one caveat: maybe it should just be --pad-names? Or something else that alludes to "padding"? I feel like "fix" can seem like a bug is involved 😛

syabro commented 1 year ago

@gustavohenke sure! --pad-names without any params would be great!

gustavohenke commented 1 week ago

🚢 This is now available in v9.0.0! https://github.com/open-cli-tools/concurrently/releases/tag/v9.0.0