nps icon indicating copy to clipboard operation
nps copied to clipboard

Better commands in series console output

Open tleunen opened this issue 8 years ago • 3 comments

I'm not sure if it's possible with the current state of nps and nps-utils, or if this is something you all would be interested in.

When I use multiple commands in series, I usually have 3 or more commands, which makes the output really not clear with the command on multiple lines.

So, instead of having this following thing:

nps executing: rimraf dist/prod && node scripts/something.js -o src/generated-file.js && webpack --config ./webpack --env.custom_value something-awesome

Because everything is in series, would it make sense to split the output in X "nps executing" lines?

nps executing: rimraf dist/prod
nps executing: node scripts/something.js -o src/generated-file.js
nps executing: webpack --config ./webpack --env.custom_value something-awesome

Or in one line, with a bit of formatting?

nps executing: rimraf dist/prod && 
    node scripts/something.js -o src/generated-file.js && 
    webpack --config ./webpack --env.custom_value something-awesome

Ideally, this should work for && in general, not only with npsUtils

tleunen avatar May 09 '17 22:05 tleunen

If we can come up with a good way to do that I'd be happy to do that. Unfortunately I don't see it being very reasonable to do reliably without parsing the command which I don't really want to do.

Now we could improve npsUtils to add a newline with series or you could write your own series function to do that.

Anyway, definitely happy to entertain a PR for that if it's reasonable.

kentcdodds avatar May 09 '17 22:05 kentcdodds

Probably better to write my own function to add the newline. Quite simple fn.

In addition to that, maybe we could have some prettyPrint functions to keep the log under 80 characters or any number of characters available in the terminal).

I wonder if something exists already for that.

tleunen avatar May 18 '17 03:05 tleunen

Not sure I follow what you mean, but I know that yargs does change it's --help output based on the width of your terminal... Maybe they use something?

kentcdodds avatar May 18 '17 03:05 kentcdodds