Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion terminal/src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ make =
flags Make.Flags
|-- onOff "debug" "Turn on the time-travelling debugger. It allows you to rewind and replay events. The events can be imported/exported into a file, which makes for very precise bug reports!"
|-- onOff "optimize" "Turn on optimizations to make code smaller and faster. For example, the compiler renames record fields to be as short as possible and unboxes values to reduce allocation."
|-- flag "output" Make.output "Specify the name of the resulting JS file. For example --output=assets/gren.js to generate the JS at assets/gren.js or --output=/dev/null to generate no output at all!"
|-- flag "output" Make.output "Specify the name of the resulting JS file. For example --output=assets/gren.js to generate the JS at assets/gren.js. You can also use --output=/dev/stdout to output the JS to the terminal, or --output=/dev/null to generate no output at all!"
|-- flag "report" Make.reportType "You can say --report=json to get error messages as JSON. This is only really useful if you are an editor plugin. Humans should avoid it!"
|-- flag "docs" Make.docsFile "Generate a JSON file of documentation for a package. Eventually it will be possible to preview docs with `reactor` because it is quite hard to deal with these JSON files directly."
in Terminal.Command "make" Uncommon details example (zeroOrMore grenFile) makeFlags Make.run
Expand Down
13 changes: 12 additions & 1 deletion terminal/src/Make.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import qualified Reporting.Exit as Exit
import qualified Reporting.Task as Task
import qualified System.Directory as Dir
import qualified System.FilePath as FP
import qualified System.IO as IO
import Terminal (Parser (..))

-- FLAGS
Expand All @@ -44,6 +45,7 @@ data Output
= JS FilePath
| Html FilePath
| DevNull
| DevStdOut

data ReportType
= Json
Expand Down Expand Up @@ -91,6 +93,14 @@ runHelp root paths style (Flags debug optimize maybeOutput _ maybeDocs) =
do
builder <- toBuilder root details desiredMode artifacts
generate style "gren.js" builder (NE.List name names)
Just DevStdOut ->
case getMains artifacts of
[] ->
return ()
_ ->
do
builder <- toBuilder root details desiredMode artifacts
Task.io $ B.hPutBuilder IO.stdout builder
Just DevNull ->
return ()
Just (JS target) ->
Expand Down Expand Up @@ -239,11 +249,12 @@ output =
_plural = "output files",
_parser = parseOutput,
_suggest = \_ -> return [],
_examples = \_ -> return ["gren.js", "index.html", "/dev/null"]
_examples = \_ -> return ["gren.js", "index.html", "/dev/null", "/dev/stdout"]
}

parseOutput :: String -> Maybe Output
parseOutput name
| name == "/dev/stdout" = Just DevStdOut
| isDevNull name = Just DevNull
| hasExt ".html" name = Just (Html name)
| hasExt ".js" name = Just (JS name)
Expand Down