on master help sign in
Fix #1286, support --version flag
1950b46Evan Czaplicki
src/CommandLineRouter.hs+9−1
@@ -10,6 +10,8 @@ import GHC.IO.Encoding (setLocaleEncoding, utf8)
10import qualified Elm.Compiler.Version as Compiler
10import qualified Elm.Compiler.Version as Compiler
11import qualified Elm.Package as Pkg
11import qualified Elm.Package as Pkg
12
12
13+
14+
13main :: IO ()
15main :: IO ()
14main =
16main =
15 do setLocaleEncoding utf8
17 do setLocaleEncoding utf8
@@ -19,6 +21,12 @@ main =
19 [] ->
21 [] ->
20 putStrLn usageMessage
22 putStrLn usageMessage
21
23
24+ "--version" ->
25+ putStrLn $ Pkg.versionToString Compiler.version
26+
27+ "-v" ->
28+ putStrLn $ Pkg.versionToString Compiler.version
29+
22 command : args ->
30 command : args ->
23 attemptToRun command args
31 attemptToRun command args
24
32
@@ -50,7 +58,7 @@ attemptToRun command args =
50
58
51usageMessage :: String
59usageMessage :: String
52usageMessage =
60usageMessage =
53− "Elm Platform " ++ (Pkg.versionToString Compiler.version) ++ " - a way to run all Elm tools\n\
61+ "Elm Platform " ++ Pkg.versionToString Compiler.version ++ " - a way to run all Elm tools\n\
54 \\n\
62 \\n\
55 \Usage: elm <command> [<args>]\n\
63 \Usage: elm <command> [<args>]\n\
56 \\n\
64 \\n\