Open maxsnew opened 7 years ago
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!
Here is what to expect next, and if anyone wants to comment, keep these things in mind.
In implementing this change and trying it out I now see that printing to /dev/stdout
would only really work if we add a --silent
option that suppresses other printing to stdout.
Looking into that, I see that this would require some changes to elm-package
.
Motivation
As a build tool for a web technology,
elm-make
is not just used directly by humans but also by build scripts that combine elm with programs written in other languages. The current interface is optimized for direct human interaction, which is a fine default but should be overridable for unforeseen use-cases. Specifically,elm make Main.elm --output=main.js
parses the filename given in the--output
option, meaning tools can't output to files that do not end injs
orhtml
.Proposal:
--format
FlagMy proposal is to add a
--format
flag that would allow you to ignore the filename and declare the intended output format directly. Currently you would have 2 options:js,html
but we can easily add more in the future if needed.This change would be backwards-compatible and wouldn't affect any user not using the feature except in that it makes
elm make -h
longer.Use Case: Output to stdout
One non-obvious side effect of this would be to partially solve https://github.com/elm-lang/elm-make/issues/39 at least on unix-like systems using
/dev/stdout
as a filename:so this would make
elm make
much easier to use for scripting for the reasons lain out in that issue. I don't know enough about Windows to say for sure, but from some brief googling it looks like this would not solve #39 for them.