filer icon indicating copy to clipboard operation
filer copied to clipboard

Configure default builtins and expose FileSystem API on shell instances

Open modeswitch opened this issue 11 years ago • 18 comments

Package them as optional programs that can run from the fs using exec.

modeswitch avatar Aug 21 '14 19:08 modeswitch

@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.

sedge avatar Oct 17 '14 16:10 sedge

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.

modeswitch avatar Oct 20 '14 01:10 modeswitch

@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.exec to run them. I think this is more future, and less common, but very interesting.

humphd avatar Oct 20 '14 01:10 humphd

@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.

modeswitch avatar Oct 20 '14 01:10 modeswitch

:) ignore me, @sedge...

humphd avatar Oct 20 '14 01:10 humphd

@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 avatar Oct 20 '14 18:10 sedge

@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 avatar Oct 20 '14 18:10 modeswitch

@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?

sedge avatar Oct 20 '14 18:10 sedge

mv and rm too. @humphd, any others?

modeswitch avatar Oct 20 '14 19:10 modeswitch

@humphd Ping

sedge avatar Nov 04 '14 20:11 sedge

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.

humphd avatar Nov 04 '14 20:11 humphd

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.

modeswitch avatar Nov 05 '14 13:11 modeswitch

PR: https://github.com/filerjs/filer/pull/336

sedge avatar Dec 08 '14 21:12 sedge

@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?

sedge avatar Dec 14 '14 17:12 sedge

No, let's not do that yet.

modeswitch avatar Dec 16 '14 06:12 modeswitch

I'm now implementing mv and cp. How closely do we need this to match the linux utility versions of these commands?

sedge avatar Jan 12 '15 20:01 sedge

As closely as possible. Is there a specific aspect you're concerned about?

modeswitch avatar Jan 13 '15 05:01 modeswitch

@modeswitch Cool. I wanted a better idea of the scope of the work is all.

sedge avatar Jan 13 '15 14:01 sedge