3import qualified System.Directory as Dir
4import qualified System.Environment as Env
5import System.Exit (exitWith)
6import System.IO (hPutStrLn, stderr, stdin, stdout)
7import qualified System.Process as Proc
8import GHC.IO.Encoding (setLocaleEncoding, utf8)
10import qualified Elm.Compiler.Version as Compiler
11import qualified Elm.Package as Pkg
17 do setLocaleEncoding utf8
19 allArgs <- Env.getArgs
25 putStrLn $ Pkg.versionToString Compiler.version
28 putStrLn $ Pkg.versionToString Compiler.version
31 attemptToRun command args
34attemptToRun :: String -> [String] -> IO ()
35attemptToRun 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?"
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
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."
78availableCommands :: 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"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list