1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Reporting.Error.Diff
9import qualified Data.List as List
10import qualified Text.PrettyPrint.ANSI.Leijen as P
12import qualified Elm.Package as Pkg
13import qualified Reporting.Error.Help as Help
22 | UnknownPackage Pkg.Name [Pkg.Name]
23 | UnknownVersion Pkg.Name Pkg.Version [Pkg.Version]
30toReport :: Error -> Help.Report
34 Help.report "CANNOT DIFF APPLICATIONS" Nothing
35 "I cannot perform diffs on applications, only packages! If you are\
36 \ just curious to see a diff, try running this command:"
37 [ P.indent 4 $ P.green $ "elm diff elm-lang/html 5.1.1 6.0.0"
40 UnknownPackage pkg suggestions ->
41 Help.report "UNKNOWN PACKAGE" Nothing
42 ( "You are trying to diff against this package:"
44 [ P.indent 4 $ P.red $ P.text $ Pkg.toString pkg
48 [ "I cannot find that package though! Maybe there is a typo?"
52 [ "I cannot find that package though! Maybe you want this one instead?"
53 , P.indent 4 $ P.dullyellow $ P.text (Pkg.toString suggestion)
57 [ "I cannot find that package though! Maybe you want one of these instead?"
58 , P.indent 4 $ P.dullyellow $ P.vcat $ map (P.text . Pkg.toString) suggestions
62 UnknownVersion _pkg vsn realVersions ->
63 Help.docReport "UNKNOWN VERSION" Nothing
65 [ "Version", P.red (P.text (Pkg.versionToString vsn))
66 , "has", "never", "been", "published,", "so", "I"
67 , "cannot", "diff", "against", "it."
70 [ "Here are all the versions that HAVE been published:"
71 , P.indent 4 $ P.dullyellow $ P.vcat $
73 sameMajor v1 v2 = Pkg._major v1 == Pkg._major v2
74 mkRow vsns = P.hsep $ map (P.text . Pkg.versionToString) vsns
76 map mkRow $ List.groupBy sameMajor (List.sort realVersions)
77 , "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