Configure default builtins and expose FileSystem API on shell instances
Package them as optional programs that can run from the fs using exec.
@modeswitch Can you expand on this a little bit? I'm unclear on how a user would access these optional programs from their Shell instance.
We've already removed zip/unzip. The idea here is to make a minimal shell that ships with Filer, and separate more complex shells into other repos. The shell constructor should take a FileSystem instance.
@sedge two ways:
- As @modeswitch says, you could extend the Shell prototype manually:
Filer.Shell.prototype.newCommand = function(path, callback) {...};
var fs = new Filer.FileSystem(..);
var sh = fs.shell();
sh.newCommand('/', function(err, result) {...});
- Another theory is that we can put commands in the filesystem itself, and use
fs.execto run them. I think this is more future, and less common, but very interesting.
@humphd I was trying to avoid describing the second experiment, since it confuses the issue :)
@sedge the first way is what we want for now.
:) ignore me, @sedge...
@humphd So that second idea, which I'm totally ignoring, would mean attaching the builtins to the FS instance and running them in the context of a Shell instance with exec? If I'm reading that right that does sound interesting.
@modeswitch @humphd Thanks for clarifying. In a nutshell, it sounds like we want multiple options for which "shell" you want access to - from barebones up to feature packed. Do we already have an idea of what combinations of builtins you want available in which repos?
@sedge We only care about the basic shell here. We can spin up other shells later. For now, the basic shell should expose the full FS API plus a few convenience functions like ls and cp.
The second method involves building a base image that would be unpacked after formatting the file system. The additional shell programs would live as JS files in the file system. Exec reads them out of the file system and runs them, just like normal programs.
@modeswitch Woah! That's really cool.
Okay, so I'll build a basic shell including the full FS API. Are there any other convenience functions you want other than ls and cp?
mv and rm too. @humphd, any others?
@humphd Ping
I’d like to see all of the following included:
cd, pwd, ls, rm, tempDir, mkdirp, mv, rm, and cp when we do it.
I think touch, exec, cat are things we can provide as extras, personally.
Dave
On Nov 4, 2014, at 3:15 PM, Kieran Sedgwick <[email protected]mailto:[email protected]> wrote:
@humphdhttps://github.com/humphd Ping
— Reply to this email directly or view it on GitHubhttps://github.com/filerjs/filer/issues/273#issuecomment-61706433.
I'd like to keep exec in here as well, if only as a basis for other shells. Other than that, the list looks OK to me.
PR: https://github.com/filerjs/filer/pull/336
@modeswitch I think I understand how to have shell methods included as files in the tree and run with exec. Would you like me to adjust me approach to match that?
No, let's not do that yet.
I'm now implementing mv and cp. How closely do we need this to match the linux utility versions of these commands?
As closely as possible. Is there a specific aspect you're concerned about?
@modeswitch Cool. I wanted a better idea of the scope of the work is all.