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

Add support for stdin #69

Open
supersym opened this issue May 2, 2013 · 0 comments
Open

Add support for stdin #69

supersym opened this issue May 2, 2013 · 0 comments

Comments

@supersym
Copy link

supersym commented May 2, 2013

I didn't do a pull request. You have a few waiting anyway.

I suggest something like, to stay in line with the rest of the code and conventions, to modify cli.coffee and append a switch e.g. -i for processing stdin.

 ['-i', '--stdin', 'accept input over standard input interface stdin']

Then add

codeIn = ""
stdin = process.openStdin()

# and under run...

if options.stdin
    # Buffer streams of data and concat to string until finished
    stdin.on 'data', (buffer) -> codeIn += buffer.toString() if buffer
    stdin.on 'end', -> log coffeecup.render codeIn

This will allow for something like

$ coffee -p -b myfile.litcoffee | js2coffee | coffeecup -i

As a little round-trip since coffeescript cli tool doesn't really allow a unmangle of the .litcoffee files yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant