3 ms·
If you're going to invoke these operations from JavaScript, why on earth would you still want to control them using command-line style switches? Reproducing the
by danellis 5y ago
If you're going to invoke these operations from JavaScript, why on earth would you still want to control them using command-line style switches? Reproducing the functionality: fine, useful. Reproducing the interface: inelegant and probably error-prone.
- anonydsfsfs 5y agoAccording to the README, the goal of this project is to "eliminate your shell script's dependency on Unix while still keeping its familiar and powerful commands". Changing the interface would add an unnecessary learning curve, since the target audience is already familiar with the conventional command-line style switches.
- rjmorris 5y agoMy concern with this approach is that it gives the impression that you can use all the same switches that are available to the real shell commands, which isn't the case. For example, taking the first command documented on the README, cat, shelljs supports the -n switch only, but `man cat` shows about 10 switches for me. So although I agree that the learning curve is lower to get started, you do have to remember that the switches are limited and be sure to check the docs to see which of your shell command switches are supported.
- anonydsfsfs 5y agoThat's a valid concern, but personally I wouldn't expect a tool like this to support anything beyond the POSIX standard switches. For "cat", POSIX only specifies a single switch: "-u", which enables unbuffered output. I've never used that switch before, and it's a no-op in both GNU cat and shelljs.