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 ( "You are trying to diff against this package:"
43 [ P.indent 4 $ P.red $ P.text $ Pkg.toString pkg
47 [ "I cannot find that package though! Maybe there is a typo?"
51 [ "I cannot find that package though! Maybe you want this one instead?"
52 , P.indent 4 $ P.dullyellow $ P.text (Pkg.toString suggestion)
56 [ "I cannot find that package though! Maybe you want one of these instead?"
57 , P.indent 4 $ P.dullyellow $ P.vcat $ map (P.text . Pkg.toString) suggestions
61 UnknownVersion _pkg vsn realVersions ->
62 Help.docReport "UNKNOWN VERSION" Nothing
64 [ "Version", P.red (P.text (Pkg.versionToString vsn))
65 , "has", "never", "been", "published,", "so", "I"
66 , "cannot", "diff", "against", "it."
69 [ "Here are all the versions that HAVE been published:"
70 , P.indent 4 $ P.dullyellow $ P.vcat $
72 sameMajor v1 v2 = Pkg._major v1 == Pkg._major v2
73 mkRow vsns = P.hsep $ map (P.text . Pkg.versionToString) vsns
75 map mkRow $ List.groupBy sameMajor (List.sort realVersions)
76 , "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