-
Notifications
You must be signed in to change notification settings - Fork 744
ShellStrings should be exposed to the plugin API #486
Description
Exposing ShellStrings through the plugin API could pave the way for interesting plugins. ShellStrings are currently somewhat modifiable by creating a new command with the canReceivePipe attribute (the command gets immediately added as a method on each ShellString). Refactoring ShellStrings to create a real ShellString.prototype might make this even more extensible. Below are two plugin ideas that might require modifying ShellStrings.
One plugin idea is to add a .inspect() method to ShellString objects (as I've done here). I could see this being useful to people who don't want to use n_shell and would rather use a standard Node REPL. Refactoring it into ShellJS proper would really improve things beyond the hack I have in n_shell, but this feature would be so infrequently used by most ShellJS users, that it might be even better if this can be written as a plugin intended only for REPL users.
Another use-case in mind would be for shelljs-exec-proxy, which would like to proxy-ify ShellStrings (so that things like cat('file.txt').tr('-d', 'A') would work out of the box using that package).
Even if these particular use-cases aren't appealing, I'm sure someone will have a more interesting use-case down the road, so it's worth thinking this over and seeing if we can think of more motivation for this.
Thoughts?