1{-# LANGUAGE OverloadedStrings #-}
2module Reporting.Exit.Diff
8import qualified Data.List as List
9import qualified Text.PrettyPrint.ANSI.Leijen as P
11import qualified Elm.Package as Pkg
12import qualified Reporting.Exit.Help as Help
21 | UnknownPackage Pkg.Name [Pkg.Name]
22 | UnknownVersion Pkg.Name Pkg.Version [Pkg.Version]
29toReport :: Exit -> Help.Report
33 Help.report "CANNOT DIFF APPLICATIONS" Nothing
34 "I cannot perform diffs on applications, only packages! If you are\
35 \ just curious to see a diff, try running this command:"
36 [ P.indent 4 $ P.green $ "elm diff elm-lang/html 5.1.1 6.0.0"
39 UnknownPackage pkg suggestions ->
40 Help.report "UNKNOWN PACKAGE" Nothing
41 ( "I cannot find a package called:"
43 [ P.indent 4 $ P.red $ P.text $ Pkg.toString pkg
44 , "Maybe you want one of these instead?"
45 , P.indent 4 $ P.dullyellow $ P.vcat $ map (P.text . Pkg.toString) suggestions
46 , "But check <https://package.elm-lang.org> to see all possibilities!"
49 UnknownVersion _pkg vsn realVersions ->
50 Help.docReport "UNKNOWN VERSION" Nothing
52 [ "Version", P.red (P.text (Pkg.versionToString vsn))
53 , "has", "never", "been", "published,", "so", "I"
54 , "cannot", "diff", "against", "it."
57 [ "Here are all the versions that HAVE been published:"
58 , P.indent 4 $ P.dullyellow $ P.vcat $
60 sameMajor v1 v2 = Pkg._major v1 == Pkg._major v2
61 mkRow vsns = P.hsep $ map (P.text . Pkg.versionToString) vsns
63 map mkRow $ List.groupBy sameMajor (List.sort realVersions)
64 , "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