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.
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, andnode.toArgs(onDone, homedirResolver, varResolver, interpolateResolver, wildcardResolver)resolves the command into strings. E.g., you'd do:(Note it doesn't consistently use Node-style callbacks)
Anyway, this code might be useful in your project.