on 64dcd7e help sign in
49 lines 1.2 kB history raw
1{-# LANGUAGE OverloadedStrings #-}
2module Reporting.Exit.Init
3 ( Exit(..)
4 , toReport
5 )
6 where
9import qualified Reporting.Doc as D
10import qualified Reporting.Exit.Help as Help
12import qualified Elm.Package as Pkg
16-- EXITS
19data Exit
20 = NoSolution [Pkg.Name]
21 | AlreadyStarted
25-- TO REPORT
28toReport :: Exit -> Help.Report
29toReport exit =
30 case exit of
31 NoSolution pkgs ->
32 Help.report "NO SOLUTION" Nothing
33 "I tried to create an elm.json with the following direct dependencies:"
34 [ D.indent 4 $ D.vcat $
35 map (D.dullyellow . D.fromString . Pkg.toString) pkgs
36 , D.reflow $
37 "I could not find compatible versions though! This should not happen, so please\
38 \ ask around one of the community forums <http://elm-lang.org/community> to learn\
39 \ what is going on!"
40 ]
42 AlreadyStarted ->
43 Help.report "EXISTING PROJECT" Nothing
44 "You already have an elm.json file, so there is nothing for me to initialize!"
45 [ D.fillSep
46 ["Maybe",D.green (D.fromString (D.makeLink "init")),"can","help"
47 ,"you","figure","out","what","to","do","next?"
48 ]
49 ]