Skip to content

Add support for stdin #69

@supersym

Description

@supersym

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions