on master help sign in
Parse the --report flag properly
commit7b6e55bc63e0f5e0e8162e2d504e2d8fd739824a authorEvan Czaplicki <evancz@users.noreply.github.com> dateTue 27 Mar 2018, 18:15 (9 years ago) parent45be9d0
2 files changed+25−8
ui/terminal/src/Main.hs+3−3 ui/terminal/src/Make.hs+22−5
ui/terminal/src/Main.hs+3−3
@@ -173,9 +173,9 @@ make =
173173
174174 makeFlags =
175175 flags Make.Flags
176− |-- onOff "warn" "Report warnings to improve code quality."
177− |-- onOff "debug" "Generate programs in debug mode."
178− |-- flag "output" Output.output "Specify the name of the resulting JS file (use --output=/dev/null for no output)"
176+ |-- onOff "debug" "Turn on debug mode. This allows you to (1) use functions like Debug.log and Debug.crash and (2) use the interactive debugger to rewind your programs."
177+ |-- flag "output" Output.output "Specify the name of the resulting JS file. For example --output=assets/elm.js to generate the JS at assets/elm.js or --output=/dev/null to generate no output at all!"
178+ |-- 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!"
179179 in
180180 Interface "make" (Common summary) details example (zeroOrMore elmFile) makeFlags Make.run
181181
ui/terminal/src/Make.hs+22−5
@@ -1,7 +1,8 @@
11module Make
22 ( Flags(..)
3− , ReportType(..)
43 , run
4+ , ReportType(..)
5+ , reportType
56 )
67 where
78
@@ -14,6 +15,7 @@ import qualified Generate.Output as Output
1415import qualified Reporting.Task as Task
1516import qualified Reporting.Progress.Json as Json
1617import qualified Reporting.Progress.Terminal as Terminal
18+import Terminal.Args (Parser(..))
1719
1820
1921
@@ -28,10 +30,6 @@ data Flags =
2830 }
2931
3032
31−data ReportType
32− = Json
33−
34−
3533run :: [FilePath] -> Flags -> IO ()
3634run paths (Flags debug output report) =
3735 let
@@ -53,3 +51,22 @@ run paths (Flags debug output report) =
5351 void $ Task.run reporter $
5452 do summary <- Project.getRoot
5553 Project.compile outputOptions summary paths
54+
55+
56+
57+-- REPORT
58+
59+
60+data ReportType
61+ = Json
62+
63+
64+reportType :: Parser ReportType
65+reportType =
66+ Parser
67+ { _singular = "report type"
68+ , _plural = "report types"
69+ , _parser = \string -> if string == "json" then Just Json else Nothing
70+ , _suggest = \_ -> return ["json"]
71+ , _examples = \_ -> return ["json"]
72+ }