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