You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems like a reasonable feature request. We could do the same for shell.mv() and shell.rm() too.
It looks like we already have something like this for shell.chmod(), where the behavior is simply console.log() each line. So this output would not be part of the .stdout string returned by the function. Does printing directly the console work for your use case, or do you need the output stored in .stdout for programmatic access?
@nfischer Thank you for such a fast response and your willingness to help!
My goal is just to print this information into the console. Still, doesn't console.log invoke process.stdout.write under the hood? If so, then there would be no flaws in its usage
Sorry, I think I was unclear. You're correct that console.log() prints to the "real" stdout. What I was talking about in my last comment is the ShellString return type, which has object properties named .stdout, .stderr, and .code: https://github.com/shelljs/shelljs#shellstringstr. We typically aim for ShellJS functions to return a string in the .stdout property which represents whatever the real Unix command would have printed to stdout (e.g., if Unix cat prints a file's contents to stdout, then shell.cat() returns a file's contents as a ShellString).
But if you don't need programmatic access to the output, then I think it's fine to just print directly to console like you've done in #1129.
The original
cp
command in Linux has-v
flag, it prints out source and destination for every copied file line-by-line, e. g.:It would be very useful to have this feature in the package, so that users could have more clue of what's going on when something is being copied.
The text was updated successfully, but these errors were encountered: