@@ -1,84 +0,0 @@
3−import qualified System.Directory as Dir
4−import qualified System.Environment as Env
5−import System.Exit (exitWith)
6−import System.IO (hPutStrLn, stderr, stdin, stdout)
7−import qualified System.Process as Proc
8−import GHC.IO.Encoding (setLocaleEncoding, utf8)
10−import qualified Elm.Compiler.Version as Compiler
11−import qualified Elm.Package as Pkg
17− do setLocaleEncoding utf8
19− allArgs <- Env.getArgs
22− putStrLn usageMessage
25− putStrLn $ Pkg.versionToString Compiler.version
28− putStrLn $ Pkg.versionToString Compiler.version
31− attemptToRun command args
34−attemptToRun :: String -> [String] -> IO ()
35−attemptToRun command args =
36− do found <- Dir.findExecutable ("elm-" ++ command)
40− "Could not find command `" ++ command ++ "`. Maybe there is a typo?\n\n\
41− \Default commands include:\n\n"
42− ++ availableCommands ++
43− "\nWhen you try to run the command `" ++ command ++ "` we actually search for an\n\
44− \ executable named elm-" ++ command ++ ". Are you able to run elm-" ++ command ++ "?\n\
45− \ Is it on your PATH?"
49− (Proc.proc path args)
50− { Proc.std_in = Proc.UseHandle stdin
51− , Proc.std_out = Proc.UseHandle stdout
52− , Proc.std_err = Proc.UseHandle stderr
55− do (_, _, _, handle) <- Proc.createProcess createProc
56− exitWith =<< Proc.waitForProcess handle
59−usageMessage :: String
61− "Elm Platform " ++ Pkg.versionToString Compiler.version ++ " - a way to run all Elm tools\n\
63− \Usage: elm <command> [<args>]\n\
65− \Available commands include:\n\n"
66− ++ availableCommands ++
67− "\nYou can learn more about a specific command by running things like:\n\
70− \ elm package --help\n\
71− \ elm <command> --help\n\
73− \In all these cases we are simply running 'elm-<command>' so if you create an\n\
74− \executable named 'elm-foobar' you will be able to run it as 'elm foobar' as\n\
75− \long as it appears on your PATH."
78−availableCommands :: String
80− " make Compile an Elm file or project into JS or HTML\n\
81− \ package Manage packages from <http://package.elm-lang.org>\n\
82− \ reactor Develop with compile-on-refresh and time-travel debugging\n\
83− \ repl A REPL for running individual expressions\n"