1{-# LANGUAGE OverloadedStrings #-}
9import Control.Monad.Trans (liftIO)
10import qualified Data.Map as Map
11import qualified System.Directory as Dir
12import System.FilePath ((</>))
14import qualified Elm.Package as Pkg
15import qualified Elm.Project.Constraint as Con
16import qualified Elm.Project.Json as Project
17import qualified Elm.Project.Licenses as Licenses
18import Elm.Project.Json (Project(..), PkgInfo(..))
19import Elm.Project.Summary (Summary)
20import qualified Elm.PerUserCache as PerUserCache
21import qualified File.IO as IO
22import qualified Reporting.Exit as Exit
23import qualified Reporting.Task as Task
24import qualified Stuff.Verify as Verify
25import qualified Json.Encode as Encode
32get :: Task.Task Summary
35 project <- Project.read "elm.json"
36 Verify.verify root project
39unsafeGet :: Task.Task (FilePath, Project)
41 (,) <$> moveToRoot <*> Project.read "elm.json"
48moveToRoot :: Task.Task FilePath
50 do maybeRoot <- liftIO $ IO.find "elm.json"
53 do liftIO $ Dir.setCurrentDirectory root
57 Task.throw Exit.NoElmJson
64getWithReplFallback :: IO FilePath
66 do maybeRoot <- IO.find "elm.json"
70 do Dir.setCurrentDirectory root
74 do cache <- PerUserCache.getReplRoot
75 let root = cache </> "tmp"
76 Dir.createDirectoryIfMissing True root
77 Dir.setCurrentDirectory root
78 IO.removeDir "elm-stuff"
79 Encode.write "elm.json" (Project.encode (Pkg replInfo))
86 { _pkg_name = Pkg.dummyName
87 , _pkg_summary = "dummy code for the REPL"
88 , _pkg_license = Licenses.bsd3
89 , _pkg_version = Pkg.dummyVersion
90 , _pkg_exposed = Project.ExposedList []
91 , _pkg_deps = Map.singleton Pkg.core Con.anything
92 , _pkg_test_deps = Map.empty
93 , _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