1{-# LANGUAGE OverloadedStrings #-}
10import Control.Monad.Trans (liftIO)
11import qualified Data.Map as Map
12import qualified System.Directory as Dir
13import System.FilePath ((</>))
15import qualified Elm.Constraint as Con
16import qualified Elm.Licenses as Licenses
17import qualified Elm.Package as Pkg
18import qualified Elm.Project.Json as Project
19import qualified Elm.Project.Summary as Summary
20import qualified Elm.PerUserCache as PerUserCache
21import qualified Elm.Version as V
22import qualified File.IO as IO
23import qualified Reporting.Exit as Exit
24import qualified Reporting.Task as Task
25import qualified Stuff.Verify as Verify
26import qualified Json.Encode as Encode
33get :: Task.Task Summary.Summary
36 project <- Project.read "elm.json"
37 Verify.verify root project
40unsafeGet :: Task.Task (FilePath, Project.Project)
42 (,) <$> moveToRoot <*> Project.read "elm.json"
49moveToRoot :: Task.Task FilePath
51 do maybeRoot <- liftIO $ IO.find "elm.json"
54 do liftIO $ Dir.setCurrentDirectory root
58 Task.throw Exit.NoElmJson
65getWithReplFallback :: IO FilePath
67 do maybeRoot <- IO.find "elm.json"
71 do Dir.setCurrentDirectory root
75 do cache <- PerUserCache.getReplRoot
76 let root = cache </> "tmp"
77 Dir.createDirectoryIfMissing True root
78 Dir.setCurrentDirectory root
79 IO.removeDir "elm-stuff"
80 Encode.write "elm.json" (Project.encode (Project.Pkg replInfo))
84replInfo :: Project.PkgInfo
87 { Project._pkg_name = Pkg.dummyName
88 , Project._pkg_summary = "dummy code for the REPL"
89 , Project._pkg_license = Licenses.bsd3
90 , Project._pkg_version = V.one
91 , Project._pkg_exposed = Project.ExposedList []
92 , Project._pkg_deps = Map.singleton Pkg.core Con.anything
93 , Project._pkg_test_deps = Map.empty
94 , Project._pkg_elm_version = Con.defaultElm
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