Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do some shell parsing #6

Open
ianb opened this issue Mar 4, 2015 · 1 comment
Open

Do some shell parsing #6

ianb opened this issue Mar 4, 2015 · 1 comment
Assignees

Comments

@ianb
Copy link

ianb commented Mar 4, 2015

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.

@sedabull
Copy link
Owner

sedabull commented Mar 4, 2015

Thank you! I will definately look into it. Parsing has been one of the great challenges of this project and I'm definately open to out-sourcing that particular aspect.

@sedabull sedabull self-assigned this Apr 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants