Skip to content

Do some shell parsing #6

@ianb

Description

@ianb

I'm checking out some different Atom shells. I notice that the shell parsing is fairly primitive in this project, e.g., echo "$PATH" doesn't expand $PATH.

I happen to have written a shell parser a while back, and maybe it would be useful. Coincidentally also written in CoffeeScript.

The code is a little old and not commented, but it might be helpful. window.parse(string) returns a Node object, and node.toArgs(onDone, homedirResolver, varResolver, interpolateResolver, wildcardResolver) resolves the command into strings. E.g., you'd do:

function varResolver(node, callback) {
  callback(process.env[node.stringContents()]);
}

(Note it doesn't consistently use Node-style callbacks)

Anyway, this code might be useful in your project.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions