1{-# OPTIONS_GHC -Wall #-}
4import qualified System.Directory as Dir
5import System.Exit (exitWith)
6import qualified System.IO as IO
7import qualified System.Process as Proc
8import GHC.IO.Encoding (setLocaleEncoding, utf8)
10import qualified Elm.Compiler as Compiler
11import qualified Elm.Package as Pkg
13import CommandLine.Args as Args
15import qualified Develop
17import qualified Install
19import qualified Publish
29 do setLocaleEncoding utf8
35 "Elm " ++ Pkg.versionToString Compiler.version
36 ++ " - Get started at <https://guide.elm-lang.org/>!"
39 putStrLn (Pkg.versionToString Compiler.version)
63attemptToRun :: String -> [String] -> IO ()
64attemptToRun command args =
65 do found <- Dir.findExecutable ("elm-" ++ command)
68 IO.hPutStrLn IO.stderr $
69 "Could not find command `" ++ command ++ "`. Maybe there is a typo?\n\n\
70 \Default commands include:\n\n"
71 ++ availableCommands ++
72 "\nWhen you try to run the command `" ++ command ++ "` we actually search for an\n\
73 \ executable named elm-" ++ command ++ ". Are you able to run elm-" ++ command ++ "?\n\
74 \ Is it on your PATH?"
77 do (_, _, _, handle) <- Proc.createProcess (Proc.proc path args)
78 exitWith =<< Proc.waitForProcess handle
83 "Elm Platform " ++ Pkg.versionToString Compiler.version ++ " - a way to run all Elm tools\n\
85 \Usage: elm <command> [<args>]\n\
87 \Available commands include:\n\n"
88 ++ availableCommands ++
89 "\nYou can learn more about a specific command by running things like:\n\
92 \ elm package --help\n\
93 \ elm <command> --help\n\
95 \In all these cases we are simply running 'elm-<command>' so if you create an\n\
96 \executable named 'elm-foobar' you will be able to run it as 'elm foobar' as\n\
97 \long as it appears on your PATH."
100availableCommands :: String
102 " make Compile an Elm file or project into JS or HTML\n\
103 \ package Manage packages from <http://package.elm-lang.org>\n\
104 \ reactor Develop with compile-on-refresh and time-travel debugging\n\
105 \ 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