1{-# LANGUAGE OverloadedStrings #-}
2module Reporting.Exit.Diff
9import qualified Data.List as List
11import qualified Elm.Package as Pkg
12import qualified Elm.Version as V
13import qualified Reporting.Doc as D
14import qualified Reporting.Exit.Help as Help
24 | UnknownPackage Pkg.Name [Pkg.Name]
25 | UnknownVersion Pkg.Name V.Version [V.Version]
32toReport :: Exit -> Help.Report
36 Help.report "CANNOT DIFF APPLICATIONS" Nothing
37 "I cannot perform diffs on applications, only packages! If you are\
38 \ just curious to see a diff, try running this command:"
39 [ D.indent 4 $ D.green $ "elm diff elm/html 5.1.1 6.0.0"
43 Help.report "UNPUBLISHED" Nothing
44 "This package is not published yet. There is nothing to diff against!"
47 UnknownPackage pkg suggestions ->
48 Help.report "UNKNOWN PACKAGE" Nothing
49 ( "I cannot find a package called:"
51 [ D.indent 4 $ D.red $ D.fromUtf8 $ Pkg.toString pkg
52 , "Maybe you want one of these instead?"
53 , D.indent 4 $ D.dullyellow $ D.vcat $ map (D.fromUtf8 . Pkg.toString) suggestions
54 , "But check <https://package.elm-lang.org> to see all possibilities!"
57 UnknownVersion _pkg vsn realVersions ->
58 Help.docReport "UNKNOWN VERSION" Nothing
60 [ "Version", D.red (D.fromUtf8 (V.toString vsn))
61 , "has", "never", "been", "published,", "so", "I"
62 , "cannot", "diff", "against", "it."
65 [ "Here are all the versions that HAVE been published:"
66 , D.indent 4 $ D.dullyellow $ D.vcat $
68 sameMajor v1 v2 = V._major v1 == V._major v2
69 mkRow vsns = D.hsep $ map (D.fromUtf8 . V.toString) vsns
71 map mkRow $ List.groupBy sameMajor (List.sort realVersions)
72 , "Want one of those instead?"
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