Add changelog command
This should be backwardscompatible with 0.0.1 json format. Also slightly change 'getTagged' to list the latest version with a tag, not the oldest.
This commit is contained in:
parent
8b7dc68491
commit
e3c20d53a8
@ -1027,6 +1027,9 @@ ghcupDownloads = M.fromList
|
|||||||
[ ( [vver|7.10.3|]
|
[ ( [vver|7.10.3|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[]
|
[]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/ghc/7.10.3/docs/html/users_guide/release-7-10-1.html|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3-src.tar.xz|]
|
[uri|https://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3-src.tar.xz|]
|
||||||
(Just [rel|ghc-7.10.3|])
|
(Just [rel|ghc-7.10.3|])
|
||||||
@ -1070,6 +1073,9 @@ ghcupDownloads = M.fromList
|
|||||||
, ( [vver|8.0.2|]
|
, ( [vver|8.0.2|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[]
|
[]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/ghc/8.0.2/docs/html/users_guide/8.0.1-notes.html|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://downloads.haskell.org/~ghc/8.0.2/ghc-8.0.2-src.tar.xz|]
|
[uri|https://downloads.haskell.org/~ghc/8.0.2/ghc-8.0.2-src.tar.xz|]
|
||||||
(Just [rel|ghc-8.0.2|])
|
(Just [rel|ghc-8.0.2|])
|
||||||
@ -1113,6 +1119,9 @@ ghcupDownloads = M.fromList
|
|||||||
, ( [vver|8.2.2|]
|
, ( [vver|8.2.2|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[]
|
[]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/ghc/8.2.2/docs/html/users_guide/8.2.2-notes.html|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://downloads.haskell.org/~ghc/8.2.2/ghc-8.2.2-src.tar.xz|]
|
[uri|https://downloads.haskell.org/~ghc/8.2.2/ghc-8.2.2-src.tar.xz|]
|
||||||
(Just [rel|ghc-8.2.2|])
|
(Just [rel|ghc-8.2.2|])
|
||||||
@ -1162,6 +1171,9 @@ ghcupDownloads = M.fromList
|
|||||||
, ( [vver|8.4.1|]
|
, ( [vver|8.4.1|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[]
|
[]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/ghc/8.4.1/docs/html/users_guide/8.4.1-notes.html|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://downloads.haskell.org/~ghc/8.4.1/ghc-8.4.1-src.tar.xz|]
|
[uri|https://downloads.haskell.org/~ghc/8.4.1/ghc-8.4.1-src.tar.xz|]
|
||||||
(Just [rel|ghc-8.4.1|])
|
(Just [rel|ghc-8.4.1|])
|
||||||
@ -1198,6 +1210,9 @@ ghcupDownloads = M.fromList
|
|||||||
, ( [vver|8.4.2|]
|
, ( [vver|8.4.2|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[]
|
[]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/ghc/8.4.2/docs/html/users_guide/8.4.2-notes.html|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://downloads.haskell.org/~ghc/8.4.2/ghc-8.4.2-src.tar.xz|]
|
[uri|https://downloads.haskell.org/~ghc/8.4.2/ghc-8.4.2-src.tar.xz|]
|
||||||
(Just [rel|ghc-8.4.2|])
|
(Just [rel|ghc-8.4.2|])
|
||||||
@ -1245,6 +1260,9 @@ ghcupDownloads = M.fromList
|
|||||||
, ( [vver|8.4.3|]
|
, ( [vver|8.4.3|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[]
|
[]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/ghc/8.4.3/docs/html/users_guide/8.4.3-notes.html|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://downloads.haskell.org/~ghc/8.4.3/ghc-8.4.3-src.tar.xz|]
|
[uri|https://downloads.haskell.org/~ghc/8.4.3/ghc-8.4.3-src.tar.xz|]
|
||||||
(Just [rel|ghc-8.4.3|])
|
(Just [rel|ghc-8.4.3|])
|
||||||
@ -1291,6 +1309,9 @@ ghcupDownloads = M.fromList
|
|||||||
, ( [vver|8.4.4|]
|
, ( [vver|8.4.4|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[]
|
[]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/ghc/8.4.4/docs/html/users_guide/8.4.4-notes.html|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://downloads.haskell.org/~ghc/8.4.4/ghc-8.4.4-src.tar.xz|]
|
[uri|https://downloads.haskell.org/~ghc/8.4.4/ghc-8.4.4-src.tar.xz|]
|
||||||
(Just [rel|ghc-8.4.4|])
|
(Just [rel|ghc-8.4.4|])
|
||||||
@ -1342,6 +1363,9 @@ ghcupDownloads = M.fromList
|
|||||||
, ( [vver|8.6.1|]
|
, ( [vver|8.6.1|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[]
|
[]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/ghc/8.6.1/docs/html/users_guide/8.6.1-notes.html|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://downloads.haskell.org/~ghc/8.6.1/ghc-8.6.1-src.tar.xz|]
|
[uri|https://downloads.haskell.org/~ghc/8.6.1/ghc-8.6.1-src.tar.xz|]
|
||||||
(Just [rel|ghc-8.6.1|])
|
(Just [rel|ghc-8.6.1|])
|
||||||
@ -1389,6 +1413,9 @@ ghcupDownloads = M.fromList
|
|||||||
, ( [vver|8.6.2|]
|
, ( [vver|8.6.2|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[]
|
[]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/ghc/8.6.2/docs/html/users_guide/8.6.2-notes.html|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://downloads.haskell.org/~ghc/8.6.2/ghc-8.6.2-src.tar.xz|]
|
[uri|https://downloads.haskell.org/~ghc/8.6.2/ghc-8.6.2-src.tar.xz|]
|
||||||
(Just [rel|ghc-8.6.2|])
|
(Just [rel|ghc-8.6.2|])
|
||||||
@ -1430,6 +1457,9 @@ ghcupDownloads = M.fromList
|
|||||||
, ( [vver|8.6.3|]
|
, ( [vver|8.6.3|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[]
|
[]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/ghc/8.6.3/docs/html/users_guide/8.6.3-notes.html|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://downloads.haskell.org/~ghc/8.6.3/ghc-8.6.3-src.tar.xz|]
|
[uri|https://downloads.haskell.org/~ghc/8.6.3/ghc-8.6.3-src.tar.xz|]
|
||||||
(Just [rel|ghc-8.6.3|])
|
(Just [rel|ghc-8.6.3|])
|
||||||
@ -1481,6 +1511,9 @@ ghcupDownloads = M.fromList
|
|||||||
, ( [vver|8.6.4|]
|
, ( [vver|8.6.4|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[]
|
[]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/ghc/8.6.4/docs/html/users_guide/8.6.4-notes.html|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://downloads.haskell.org/~ghc/8.6.4/ghc-8.6.4-src.tar.xz|]
|
[uri|https://downloads.haskell.org/~ghc/8.6.4/ghc-8.6.4-src.tar.xz|]
|
||||||
(Just [rel|ghc-8.6.4|])
|
(Just [rel|ghc-8.6.4|])
|
||||||
@ -1527,6 +1560,9 @@ ghcupDownloads = M.fromList
|
|||||||
, ( [vver|8.6.5|]
|
, ( [vver|8.6.5|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[]
|
[]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/ghc/8.6.5/docs/html/users_guide/8.6.5-notes.html|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://downloads.haskell.org/~ghc/8.6.5/ghc-8.6.5-src.tar.xz|]
|
[uri|https://downloads.haskell.org/~ghc/8.6.5/ghc-8.6.5-src.tar.xz|]
|
||||||
(Just [rel|ghc-8.6.5|])
|
(Just [rel|ghc-8.6.5|])
|
||||||
@ -1577,6 +1613,9 @@ ghcupDownloads = M.fromList
|
|||||||
, ( [vver|8.8.1|]
|
, ( [vver|8.8.1|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[]
|
[]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/ghc/8.8.1/docs/html/users_guide/8.8.1-notes.html|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://downloads.haskell.org/~ghc/8.8.1/ghc-8.8.1-src.tar.xz|]
|
[uri|https://downloads.haskell.org/~ghc/8.8.1/ghc-8.8.1-src.tar.xz|]
|
||||||
(Just [rel|ghc-8.8.1|])
|
(Just [rel|ghc-8.8.1|])
|
||||||
@ -1627,6 +1666,9 @@ ghcupDownloads = M.fromList
|
|||||||
, ( [vver|8.8.2|]
|
, ( [vver|8.8.2|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[]
|
[]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/ghc/8.8.2/docs/html/users_guide/8.8.2-notes.html|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://downloads.haskell.org/~ghc/8.8.2/ghc-8.8.2-src.tar.xz|]
|
[uri|https://downloads.haskell.org/~ghc/8.8.2/ghc-8.8.2-src.tar.xz|]
|
||||||
(Just [rel|ghc-8.8.2|])
|
(Just [rel|ghc-8.8.2|])
|
||||||
@ -1677,6 +1719,9 @@ ghcupDownloads = M.fromList
|
|||||||
, ( [vver|8.8.3|]
|
, ( [vver|8.8.3|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[Recommended]
|
[Recommended]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/ghc/8.8.3/docs/html/users_guide/8.8.3-notes.html|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://downloads.haskell.org/~ghc/8.8.3/ghc-8.8.3-src.tar.xz|]
|
[uri|https://downloads.haskell.org/~ghc/8.8.3/ghc-8.8.3-src.tar.xz|]
|
||||||
(Just [rel|ghc-8.8.3|])
|
(Just [rel|ghc-8.8.3|])
|
||||||
@ -1727,6 +1772,9 @@ ghcupDownloads = M.fromList
|
|||||||
, ( [vver|8.10.1|]
|
, ( [vver|8.10.1|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[Latest]
|
[Latest]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/ghc/8.10.1/docs/html/users_guide/8.10.1-notes.html|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://downloads.haskell.org/~ghc/8.10.1/ghc-8.10.1-src.tar.xz|]
|
[uri|https://downloads.haskell.org/~ghc/8.10.1/ghc-8.10.1-src.tar.xz|]
|
||||||
(Just [rel|ghc-8.10.1|])
|
(Just [rel|ghc-8.10.1|])
|
||||||
@ -1796,6 +1844,9 @@ ghcupDownloads = M.fromList
|
|||||||
[ ( [vver|2.4.1.0|]
|
[ ( [vver|2.4.1.0|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[]
|
[]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/~cabal/cabal-install-2.4.1.0/changelog|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://github.com/haskell/cabal/archive/cabal-install-v2.4.1.0.tar.gz|]
|
[uri|https://github.com/haskell/cabal/archive/cabal-install-v2.4.1.0.tar.gz|]
|
||||||
(Just [rel|cabal-cabal-install-v2.4.1.0/cabal-install|])
|
(Just [rel|cabal-cabal-install-v2.4.1.0/cabal-install|])
|
||||||
@ -1824,6 +1875,9 @@ ghcupDownloads = M.fromList
|
|||||||
, ( [vver|3.0.0.0|]
|
, ( [vver|3.0.0.0|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[]
|
[]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/~cabal/cabal-install-3.0.0.0/changelog|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://github.com/haskell/cabal/archive/cabal-install-v3.0.0.0.tar.gz|]
|
[uri|https://github.com/haskell/cabal/archive/cabal-install-v3.0.0.0.tar.gz|]
|
||||||
(Just [rel|cabal-cabal-install-v3.0.0.0/cabal-install|])
|
(Just [rel|cabal-cabal-install-v3.0.0.0/cabal-install|])
|
||||||
@ -1850,6 +1904,9 @@ ghcupDownloads = M.fromList
|
|||||||
, ( [vver|3.2.0.0|]
|
, ( [vver|3.2.0.0|]
|
||||||
, VersionInfo
|
, VersionInfo
|
||||||
[Recommended, Latest]
|
[Recommended, Latest]
|
||||||
|
(Just
|
||||||
|
[uri|https://downloads.haskell.org/~cabal/cabal-install-3.2.0.0/changelog|]
|
||||||
|
)
|
||||||
(Just $ DownloadInfo
|
(Just $ DownloadInfo
|
||||||
[uri|https://github.com/haskell/cabal/archive/cabal-install-v3.2.0.0.tar.gz|]
|
[uri|https://github.com/haskell/cabal/archive/cabal-install-v3.2.0.0.tar.gz|]
|
||||||
(Just [rel|cabal-cabal-install-v3.2.0.0/cabal-install|])
|
(Just [rel|cabal-cabal-install-v3.2.0.0/cabal-install|])
|
||||||
@ -1878,19 +1935,30 @@ ghcupDownloads = M.fromList
|
|||||||
, ( GHCup
|
, ( GHCup
|
||||||
, M.fromList
|
, M.fromList
|
||||||
[ ( [vver|0.1.4|]
|
[ ( [vver|0.1.4|]
|
||||||
, VersionInfo [Recommended, Latest] Nothing $ M.fromList
|
, VersionInfo
|
||||||
[ ( A_64
|
[Recommended, Latest]
|
||||||
, M.fromList
|
(Just
|
||||||
[ (Linux UnknownLinux, M.fromList [(Nothing, ghcup_014_64_linux)])
|
[uri|https://gitlab.haskell.org/haskell/ghcup-hs/-/blob/master/CHANGELOG.md|]
|
||||||
, (Darwin, M.fromList [(Nothing, ghcup_014_64_darwin10_13)])
|
)
|
||||||
, (FreeBSD, M.fromList [(Nothing, ghcup_014_64_freebsd)])
|
Nothing
|
||||||
|
$ M.fromList
|
||||||
|
[ ( A_64
|
||||||
|
, M.fromList
|
||||||
|
[ ( Linux UnknownLinux
|
||||||
|
, M.fromList [(Nothing, ghcup_014_64_linux)]
|
||||||
|
)
|
||||||
|
, (Darwin , M.fromList [(Nothing, ghcup_014_64_darwin10_13)])
|
||||||
|
, (FreeBSD, M.fromList [(Nothing, ghcup_014_64_freebsd)])
|
||||||
|
]
|
||||||
|
)
|
||||||
|
, ( A_32
|
||||||
|
, M.fromList
|
||||||
|
[ ( Linux UnknownLinux
|
||||||
|
, M.fromList [(Nothing, ghcup_014_32_linux)]
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
]
|
]
|
||||||
)
|
|
||||||
, ( A_32
|
|
||||||
, M.fromList
|
|
||||||
[(Linux UnknownLinux, M.fromList [(Nothing, ghcup_014_32_linux)])]
|
|
||||||
)
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
@ -33,6 +33,7 @@ import Data.Char
|
|||||||
import Data.Either
|
import Data.Either
|
||||||
import Data.Functor
|
import Data.Functor
|
||||||
import Data.List ( intercalate )
|
import Data.List ( intercalate )
|
||||||
|
import Data.Maybe
|
||||||
import Data.String.Interpolate
|
import Data.String.Interpolate
|
||||||
import Data.Text ( Text )
|
import Data.Text ( Text )
|
||||||
import Data.Versions
|
import Data.Versions
|
||||||
@ -85,6 +86,7 @@ data Command
|
|||||||
| Compile CompileCommand
|
| Compile CompileCommand
|
||||||
| Upgrade UpgradeOpts Bool
|
| Upgrade UpgradeOpts Bool
|
||||||
| ToolRequirements
|
| ToolRequirements
|
||||||
|
| ChangeLog ChangeLogOptions
|
||||||
|
|
||||||
data ToolVersion = ToolVersion Version
|
data ToolVersion = ToolVersion Version
|
||||||
| ToolTag Tag
|
| ToolTag Tag
|
||||||
@ -126,17 +128,19 @@ data UpgradeOpts = UpgradeInplace
|
|||||||
| UpgradeGHCupDir
|
| UpgradeGHCupDir
|
||||||
deriving Show
|
deriving Show
|
||||||
|
|
||||||
|
data ChangeLogOptions = ChangeLogOptions
|
||||||
|
{ clOpen :: Bool
|
||||||
|
, clTool :: Maybe Tool
|
||||||
|
, clToolVer :: Maybe ToolVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
opts :: Parser Options
|
opts :: Parser Options
|
||||||
opts =
|
opts =
|
||||||
Options
|
Options
|
||||||
<$> switch
|
<$> switch (short 'v' <> long "verbose" <> help "Enable verbosity")
|
||||||
(short 'v' <> long "verbose" <> help
|
|
||||||
"Enable verbosity"
|
|
||||||
)
|
|
||||||
<*> switch
|
<*> switch
|
||||||
(short 'c' <> long "cache" <> help
|
(short 'c' <> long "cache" <> help "Cache downloads in ~/.ghcup/cache"
|
||||||
"Cache downloads in ~/.ghcup/cache"
|
|
||||||
)
|
)
|
||||||
<*> (optional
|
<*> (optional
|
||||||
(option
|
(option
|
||||||
@ -164,15 +168,21 @@ com =
|
|||||||
subparser
|
subparser
|
||||||
( command
|
( command
|
||||||
"install"
|
"install"
|
||||||
((info ((Install <$> installOpts) <**> helper)
|
((info
|
||||||
(progDesc "Install or update GHC" <> footerDoc (Just $ text installFooter))
|
((Install <$> installOpts) <**> helper)
|
||||||
|
( progDesc "Install or update GHC"
|
||||||
|
<> footerDoc (Just $ text installFooter)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
<> command
|
<> command
|
||||||
"set"
|
"set"
|
||||||
( SetGHC
|
( SetGHC
|
||||||
<$> (info (setGHCOpts <**> helper)
|
<$> (info
|
||||||
(progDesc "Set currently active GHC version" <> footerDoc (Just $ text setFooter))
|
(setGHCOpts <**> helper)
|
||||||
|
( progDesc "Set currently active GHC version"
|
||||||
|
<> footerDoc (Just $ text setFooter)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
<> command
|
<> command
|
||||||
@ -183,8 +193,11 @@ com =
|
|||||||
|
|
||||||
<> command
|
<> command
|
||||||
"install-cabal"
|
"install-cabal"
|
||||||
((info ((InstallCabal <$> installOpts) <**> helper)
|
((info
|
||||||
(progDesc "Install or update cabal" <> footerDoc (Just $ text installCabalFooter))
|
((InstallCabal <$> installOpts) <**> helper)
|
||||||
|
( progDesc "Install or update cabal"
|
||||||
|
<> footerDoc (Just $ text installCabalFooter)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
<> command
|
<> command
|
||||||
@ -196,12 +209,14 @@ com =
|
|||||||
)
|
)
|
||||||
<> command
|
<> command
|
||||||
"upgrade"
|
"upgrade"
|
||||||
(info ((Upgrade <$> upgradeOptsP <*>
|
(info
|
||||||
switch
|
( (Upgrade <$> upgradeOptsP <*> switch
|
||||||
(short 'f' <> long "force" <> help
|
(short 'f' <> long "force" <> help "Force update")
|
||||||
"Force update"
|
)
|
||||||
)
|
<**> helper
|
||||||
) <**> helper) (progDesc "Upgrade ghcup"))
|
)
|
||||||
|
(progDesc "Upgrade ghcup")
|
||||||
|
)
|
||||||
<> command
|
<> command
|
||||||
"compile"
|
"compile"
|
||||||
( Compile
|
( Compile
|
||||||
@ -222,6 +237,14 @@ com =
|
|||||||
(progDesc "Show the requirements for ghc/cabal")
|
(progDesc "Show the requirements for ghc/cabal")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
<> command
|
||||||
|
"changelog"
|
||||||
|
((info (fmap ChangeLog changelogP <**> helper)
|
||||||
|
(progDesc "Find/show changelog"
|
||||||
|
<> footerDoc (Just $ text changeLogFooter)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
<> commandGroup "Other commands:"
|
<> commandGroup "Other commands:"
|
||||||
<> hidden
|
<> hidden
|
||||||
)
|
)
|
||||||
@ -240,7 +263,9 @@ com =
|
|||||||
"cabal install cabal-install", which installs into "~/.cabal/bin" by
|
"cabal install cabal-install", which installs into "~/.cabal/bin" by
|
||||||
default. Make sure to set up your PATH appropriately, so the cabal
|
default. Make sure to set up your PATH appropriately, so the cabal
|
||||||
installation takes precedence.|]
|
installation takes precedence.|]
|
||||||
|
changeLogFooter = [i|Discussion:
|
||||||
|
By default returns the URI of the ChangeLog of the latest GHC release.
|
||||||
|
Pass '-o' to automatically open via xdg-open.|]
|
||||||
|
|
||||||
|
|
||||||
installOpts :: Parser InstallOptions
|
installOpts :: Parser InstallOptions
|
||||||
@ -288,19 +313,47 @@ rmOpts :: Parser RmOptions
|
|||||||
rmOpts = RmOptions <$> versionArgument
|
rmOpts = RmOptions <$> versionArgument
|
||||||
|
|
||||||
|
|
||||||
|
changelogP :: Parser ChangeLogOptions
|
||||||
|
changelogP =
|
||||||
|
(\x y -> ChangeLogOptions x y)
|
||||||
|
<$> switch (short 'o' <> long "open" <> help "xdg-open the changelog url")
|
||||||
|
<*> (optional
|
||||||
|
(option
|
||||||
|
(eitherReader
|
||||||
|
(\s' -> case fmap toLower s' of
|
||||||
|
"ghc" -> Right GHC
|
||||||
|
"cabal" -> Right Cabal
|
||||||
|
"ghcup" -> Right GHCup
|
||||||
|
e -> Left $ e
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(short 't' <> long "tool" <> metavar "<ghc|cabal|ghcup>" <> help
|
||||||
|
"Open changelog for given tool (default: ghc)"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
<*> optional toolVersionArgument
|
||||||
|
|
||||||
compileP :: Parser CompileCommand
|
compileP :: Parser CompileCommand
|
||||||
compileP = subparser
|
compileP = subparser
|
||||||
( command
|
( command
|
||||||
"ghc"
|
"ghc"
|
||||||
( CompileGHC
|
( CompileGHC
|
||||||
<$> (info (compileOpts <**> helper) (progDesc "Compile GHC from source" <> footerDoc (Just $ text compileFooter))
|
<$> (info
|
||||||
|
(compileOpts <**> helper)
|
||||||
|
( progDesc "Compile GHC from source"
|
||||||
|
<> footerDoc (Just $ text compileFooter)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
<> command
|
<> command
|
||||||
"cabal"
|
"cabal"
|
||||||
( CompileCabal
|
( CompileCabal
|
||||||
<$> (info (compileOpts <**> helper)
|
<$> (info
|
||||||
(progDesc "Compile Cabal from source" <> footerDoc (Just $ text compileCabalFooter))
|
(compileOpts <**> helper)
|
||||||
|
( progDesc "Compile Cabal from source"
|
||||||
|
<> footerDoc (Just $ text compileCabalFooter)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -401,9 +454,7 @@ toolVersionArgument =
|
|||||||
|
|
||||||
|
|
||||||
versionArgument :: Parser Version
|
versionArgument :: Parser Version
|
||||||
versionArgument = argument
|
versionArgument = argument (eitherReader versionEither) (metavar "VERSION")
|
||||||
(eitherReader versionEither)
|
|
||||||
(metavar "VERSION")
|
|
||||||
|
|
||||||
versionParser :: Parser Version
|
versionParser :: Parser Version
|
||||||
versionParser = option
|
versionParser = option
|
||||||
@ -420,9 +471,9 @@ tagEither s' = case fmap toLower s' of
|
|||||||
versionEither :: String -> Either String Version
|
versionEither :: String -> Either String Version
|
||||||
versionEither s' =
|
versionEither s' =
|
||||||
-- 'version' is a bit too lax and will parse typoed tags
|
-- 'version' is a bit too lax and will parse typoed tags
|
||||||
case readMaybe ((:[]) . head $ s') :: Maybe Int of
|
case readMaybe ((: []) . head $ s') :: Maybe Int of
|
||||||
Just _ -> bimap (const "Not a valid version") id . version . T.pack $ s'
|
Just _ -> bimap (const "Not a valid version") id . version . T.pack $ s'
|
||||||
Nothing -> Left "Not a valid version"
|
Nothing -> Left "Not a valid version"
|
||||||
|
|
||||||
toolVersionEither :: String -> Either String ToolVersion
|
toolVersionEither :: String -> Either String ToolVersion
|
||||||
toolVersionEither s' =
|
toolVersionEither s' =
|
||||||
@ -582,7 +633,9 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
|
|
||||||
customExecParser
|
customExecParser
|
||||||
(prefs showHelpOnError)
|
(prefs showHelpOnError)
|
||||||
(info (opts <**> helper <**> versionHelp <**> numericVersionHelp) (footerDoc (Just $ text main_footer)))
|
(info (opts <**> helper <**> versionHelp <**> numericVersionHelp)
|
||||||
|
(footerDoc (Just $ text main_footer))
|
||||||
|
)
|
||||||
>>= \opt@Options {..} -> do
|
>>= \opt@Options {..} -> do
|
||||||
let settings = toSettings opt
|
let settings = toSettings opt
|
||||||
|
|
||||||
@ -895,6 +948,38 @@ Check the logs at ~/.ghcup/logs and the build directory #{tmpdir} for more clues
|
|||||||
)
|
)
|
||||||
pure $ ExitFailure 12
|
pure $ ExitFailure 12
|
||||||
|
|
||||||
|
ChangeLog (ChangeLogOptions {..}) -> do
|
||||||
|
let tool = fromMaybe GHC clTool
|
||||||
|
ver' = maybe
|
||||||
|
(Right Latest)
|
||||||
|
(\case
|
||||||
|
ToolVersion tv -> Left tv
|
||||||
|
ToolTag t -> Right t
|
||||||
|
)
|
||||||
|
clToolVer
|
||||||
|
muri = getChangeLog dls tool ver'
|
||||||
|
case muri of
|
||||||
|
Nothing -> do
|
||||||
|
runLogger
|
||||||
|
($(logWarn)
|
||||||
|
[i|Could not find ChangeLog for #{tool}, version #{either (T.unpack . prettyVer) show ver'}|]
|
||||||
|
)
|
||||||
|
pure ExitSuccess
|
||||||
|
Just uri -> do
|
||||||
|
let uri' = T.unpack . decUTF8Safe . serializeURIRef' $ uri
|
||||||
|
if clOpen
|
||||||
|
then
|
||||||
|
exec "xdg-open"
|
||||||
|
True
|
||||||
|
[serializeURIRef' uri]
|
||||||
|
Nothing
|
||||||
|
Nothing
|
||||||
|
>>= \case
|
||||||
|
Right _ -> pure ExitSuccess
|
||||||
|
Left e -> runLogger ($(logError) [i|#{e}|])
|
||||||
|
>> pure (ExitFailure 13)
|
||||||
|
else putStrLn uri' >> pure ExitSuccess
|
||||||
|
|
||||||
case res of
|
case res of
|
||||||
ExitSuccess -> pure ()
|
ExitSuccess -> pure ()
|
||||||
ef@(ExitFailure _) -> exitWith ef
|
ef@(ExitFailure _) -> exitWith ef
|
||||||
|
@ -170,6 +170,7 @@
|
|||||||
"dlSubdir": "ghc-8.6.2",
|
"dlSubdir": "ghc-8.6.2",
|
||||||
"dlUri": "https://downloads.haskell.org/~ghc/8.6.2/ghc-8.6.2-src.tar.xz"
|
"dlUri": "https://downloads.haskell.org/~ghc/8.6.2/ghc-8.6.2-src.tar.xz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/ghc/8.6.2/docs/html/users_guide/8.6.2-notes.html",
|
||||||
"viTags": []
|
"viTags": []
|
||||||
},
|
},
|
||||||
"8.0.2": {
|
"8.0.2": {
|
||||||
@ -264,6 +265,7 @@
|
|||||||
"dlSubdir": "ghc-8.0.2",
|
"dlSubdir": "ghc-8.0.2",
|
||||||
"dlUri": "https://downloads.haskell.org/~ghc/8.0.2/ghc-8.0.2-src.tar.xz"
|
"dlUri": "https://downloads.haskell.org/~ghc/8.0.2/ghc-8.0.2-src.tar.xz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/ghc/8.0.2/docs/html/users_guide/8.0.1-notes.html",
|
||||||
"viTags": []
|
"viTags": []
|
||||||
},
|
},
|
||||||
"8.6.4": {
|
"8.6.4": {
|
||||||
@ -377,6 +379,7 @@
|
|||||||
"dlSubdir": "ghc-8.6.4",
|
"dlSubdir": "ghc-8.6.4",
|
||||||
"dlUri": "https://downloads.haskell.org/~ghc/8.6.4/ghc-8.6.4-src.tar.xz"
|
"dlUri": "https://downloads.haskell.org/~ghc/8.6.4/ghc-8.6.4-src.tar.xz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/ghc/8.6.4/docs/html/users_guide/8.6.4-notes.html",
|
||||||
"viTags": []
|
"viTags": []
|
||||||
},
|
},
|
||||||
"8.4.1": {
|
"8.4.1": {
|
||||||
@ -482,6 +485,7 @@
|
|||||||
"dlSubdir": "ghc-8.4.1",
|
"dlSubdir": "ghc-8.4.1",
|
||||||
"dlUri": "https://downloads.haskell.org/~ghc/8.4.1/ghc-8.4.1-src.tar.xz"
|
"dlUri": "https://downloads.haskell.org/~ghc/8.4.1/ghc-8.4.1-src.tar.xz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/ghc/8.4.1/docs/html/users_guide/8.4.1-notes.html",
|
||||||
"viTags": []
|
"viTags": []
|
||||||
},
|
},
|
||||||
"8.6.3": {
|
"8.6.3": {
|
||||||
@ -616,6 +620,7 @@
|
|||||||
"dlSubdir": "ghc-8.6.3",
|
"dlSubdir": "ghc-8.6.3",
|
||||||
"dlUri": "https://downloads.haskell.org/~ghc/8.6.3/ghc-8.6.3-src.tar.xz"
|
"dlUri": "https://downloads.haskell.org/~ghc/8.6.3/ghc-8.6.3-src.tar.xz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/ghc/8.6.3/docs/html/users_guide/8.6.3-notes.html",
|
||||||
"viTags": []
|
"viTags": []
|
||||||
},
|
},
|
||||||
"8.10.1": {
|
"8.10.1": {
|
||||||
@ -756,6 +761,7 @@
|
|||||||
"dlSubdir": "ghc-8.10.1",
|
"dlSubdir": "ghc-8.10.1",
|
||||||
"dlUri": "https://downloads.haskell.org/~ghc/8.10.1/ghc-8.10.1-src.tar.xz"
|
"dlUri": "https://downloads.haskell.org/~ghc/8.10.1/ghc-8.10.1-src.tar.xz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/ghc/8.10.1/docs/html/users_guide/8.10.1-notes.html",
|
||||||
"viTags": [
|
"viTags": [
|
||||||
"Latest"
|
"Latest"
|
||||||
]
|
]
|
||||||
@ -885,6 +891,7 @@
|
|||||||
"dlSubdir": "ghc-8.6.5",
|
"dlSubdir": "ghc-8.6.5",
|
||||||
"dlUri": "https://downloads.haskell.org/~ghc/8.6.5/ghc-8.6.5-src.tar.xz"
|
"dlUri": "https://downloads.haskell.org/~ghc/8.6.5/ghc-8.6.5-src.tar.xz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/ghc/8.6.5/docs/html/users_guide/8.6.5-notes.html",
|
||||||
"viTags": []
|
"viTags": []
|
||||||
},
|
},
|
||||||
"8.4.2": {
|
"8.4.2": {
|
||||||
@ -1005,6 +1012,7 @@
|
|||||||
"dlSubdir": "ghc-8.4.2",
|
"dlSubdir": "ghc-8.4.2",
|
||||||
"dlUri": "https://downloads.haskell.org/~ghc/8.4.2/ghc-8.4.2-src.tar.xz"
|
"dlUri": "https://downloads.haskell.org/~ghc/8.4.2/ghc-8.4.2-src.tar.xz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/ghc/8.4.2/docs/html/users_guide/8.4.2-notes.html",
|
||||||
"viTags": []
|
"viTags": []
|
||||||
},
|
},
|
||||||
"8.8.1": {
|
"8.8.1": {
|
||||||
@ -1132,6 +1140,7 @@
|
|||||||
"dlSubdir": "ghc-8.8.1",
|
"dlSubdir": "ghc-8.8.1",
|
||||||
"dlUri": "https://downloads.haskell.org/~ghc/8.8.1/ghc-8.8.1-src.tar.xz"
|
"dlUri": "https://downloads.haskell.org/~ghc/8.8.1/ghc-8.8.1-src.tar.xz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/ghc/8.8.1/docs/html/users_guide/8.8.1-notes.html",
|
||||||
"viTags": []
|
"viTags": []
|
||||||
},
|
},
|
||||||
"8.4.3": {
|
"8.4.3": {
|
||||||
@ -1245,6 +1254,7 @@
|
|||||||
"dlSubdir": "ghc-8.4.3",
|
"dlSubdir": "ghc-8.4.3",
|
||||||
"dlUri": "https://downloads.haskell.org/~ghc/8.4.3/ghc-8.4.3-src.tar.xz"
|
"dlUri": "https://downloads.haskell.org/~ghc/8.4.3/ghc-8.4.3-src.tar.xz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/ghc/8.4.3/docs/html/users_guide/8.4.3-notes.html",
|
||||||
"viTags": []
|
"viTags": []
|
||||||
},
|
},
|
||||||
"8.6.1": {
|
"8.6.1": {
|
||||||
@ -1365,6 +1375,7 @@
|
|||||||
"dlSubdir": "ghc-8.6.1",
|
"dlSubdir": "ghc-8.6.1",
|
||||||
"dlUri": "https://downloads.haskell.org/~ghc/8.6.1/ghc-8.6.1-src.tar.xz"
|
"dlUri": "https://downloads.haskell.org/~ghc/8.6.1/ghc-8.6.1-src.tar.xz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/ghc/8.6.1/docs/html/users_guide/8.6.1-notes.html",
|
||||||
"viTags": []
|
"viTags": []
|
||||||
},
|
},
|
||||||
"8.8.2": {
|
"8.8.2": {
|
||||||
@ -1492,6 +1503,7 @@
|
|||||||
"dlSubdir": "ghc-8.8.2",
|
"dlSubdir": "ghc-8.8.2",
|
||||||
"dlUri": "https://downloads.haskell.org/~ghc/8.8.2/ghc-8.8.2-src.tar.xz"
|
"dlUri": "https://downloads.haskell.org/~ghc/8.8.2/ghc-8.8.2-src.tar.xz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/ghc/8.8.2/docs/html/users_guide/8.8.2-notes.html",
|
||||||
"viTags": []
|
"viTags": []
|
||||||
},
|
},
|
||||||
"7.10.3": {
|
"7.10.3": {
|
||||||
@ -1618,6 +1630,7 @@
|
|||||||
"dlSubdir": "ghc-7.10.3",
|
"dlSubdir": "ghc-7.10.3",
|
||||||
"dlUri": "https://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3-src.tar.xz"
|
"dlUri": "https://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3-src.tar.xz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/ghc/7.10.3/docs/html/users_guide/release-7-10-1.html",
|
||||||
"viTags": []
|
"viTags": []
|
||||||
},
|
},
|
||||||
"8.2.2": {
|
"8.2.2": {
|
||||||
@ -1722,6 +1735,7 @@
|
|||||||
"dlSubdir": "ghc-8.2.2",
|
"dlSubdir": "ghc-8.2.2",
|
||||||
"dlUri": "https://downloads.haskell.org/~ghc/8.2.2/ghc-8.2.2-src.tar.xz"
|
"dlUri": "https://downloads.haskell.org/~ghc/8.2.2/ghc-8.2.2-src.tar.xz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/ghc/8.2.2/docs/html/users_guide/8.2.2-notes.html",
|
||||||
"viTags": []
|
"viTags": []
|
||||||
},
|
},
|
||||||
"8.4.4": {
|
"8.4.4": {
|
||||||
@ -1856,6 +1870,7 @@
|
|||||||
"dlSubdir": "ghc-8.4.4",
|
"dlSubdir": "ghc-8.4.4",
|
||||||
"dlUri": "https://downloads.haskell.org/~ghc/8.4.4/ghc-8.4.4-src.tar.xz"
|
"dlUri": "https://downloads.haskell.org/~ghc/8.4.4/ghc-8.4.4-src.tar.xz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/ghc/8.4.4/docs/html/users_guide/8.4.4-notes.html",
|
||||||
"viTags": []
|
"viTags": []
|
||||||
},
|
},
|
||||||
"8.8.3": {
|
"8.8.3": {
|
||||||
@ -1983,6 +1998,7 @@
|
|||||||
"dlSubdir": "ghc-8.8.3",
|
"dlSubdir": "ghc-8.8.3",
|
||||||
"dlUri": "https://downloads.haskell.org/~ghc/8.8.3/ghc-8.8.3-src.tar.xz"
|
"dlUri": "https://downloads.haskell.org/~ghc/8.8.3/ghc-8.8.3-src.tar.xz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/ghc/8.8.3/docs/html/users_guide/8.8.3-notes.html",
|
||||||
"viTags": [
|
"viTags": [
|
||||||
"Recommended"
|
"Recommended"
|
||||||
]
|
]
|
||||||
@ -2022,6 +2038,7 @@
|
|||||||
"dlSubdir": "cabal-cabal-install-v3.0.0.0/cabal-install",
|
"dlSubdir": "cabal-cabal-install-v3.0.0.0/cabal-install",
|
||||||
"dlUri": "https://github.com/haskell/cabal/archive/cabal-install-v3.0.0.0.tar.gz"
|
"dlUri": "https://github.com/haskell/cabal/archive/cabal-install-v3.0.0.0.tar.gz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/~cabal/cabal-install-3.0.0.0/changelog",
|
||||||
"viTags": []
|
"viTags": []
|
||||||
},
|
},
|
||||||
"3.2.0.0": {
|
"3.2.0.0": {
|
||||||
@ -2057,6 +2074,7 @@
|
|||||||
"dlSubdir": "cabal-cabal-install-v3.2.0.0/cabal-install",
|
"dlSubdir": "cabal-cabal-install-v3.2.0.0/cabal-install",
|
||||||
"dlUri": "https://github.com/haskell/cabal/archive/cabal-install-v3.2.0.0.tar.gz"
|
"dlUri": "https://github.com/haskell/cabal/archive/cabal-install-v3.2.0.0.tar.gz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/~cabal/cabal-install-3.2.0.0/changelog",
|
||||||
"viTags": [
|
"viTags": [
|
||||||
"Recommended",
|
"Recommended",
|
||||||
"Latest"
|
"Latest"
|
||||||
@ -2109,6 +2127,7 @@
|
|||||||
"dlSubdir": "cabal-cabal-install-v2.4.1.0/cabal-install",
|
"dlSubdir": "cabal-cabal-install-v2.4.1.0/cabal-install",
|
||||||
"dlUri": "https://github.com/haskell/cabal/archive/cabal-install-v2.4.1.0.tar.gz"
|
"dlUri": "https://github.com/haskell/cabal/archive/cabal-install-v2.4.1.0.tar.gz"
|
||||||
},
|
},
|
||||||
|
"viChangeLog": "https://downloads.haskell.org/~cabal/cabal-install-2.4.1.0/changelog",
|
||||||
"viTags": []
|
"viTags": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -2149,6 +2168,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"viSourceDL": null,
|
"viSourceDL": null,
|
||||||
|
"viChangeLog": "https://gitlab.haskell.org/haskell/ghcup-hs/-/blob/master/CHANGELOG.md",
|
||||||
"viTags": [
|
"viTags": [
|
||||||
"Recommended",
|
"Recommended",
|
||||||
"Latest"
|
"Latest"
|
||||||
|
@ -70,9 +70,10 @@ data Tool = GHC
|
|||||||
-- | All necessary information of a tool version, including
|
-- | All necessary information of a tool version, including
|
||||||
-- source download and per-architecture downloads.
|
-- source download and per-architecture downloads.
|
||||||
data VersionInfo = VersionInfo
|
data VersionInfo = VersionInfo
|
||||||
{ _viTags :: [Tag] -- ^ version specific tag
|
{ _viTags :: [Tag] -- ^ version specific tag
|
||||||
, _viSourceDL :: Maybe DownloadInfo -- ^ source tarball
|
, _viChangeLog :: Maybe URI
|
||||||
, _viArch :: ArchitectureSpec -- ^ descend for binary downloads per arch
|
, _viSourceDL :: Maybe DownloadInfo -- ^ source tarball
|
||||||
|
, _viArch :: ArchitectureSpec -- ^ descend for binary downloads per arch
|
||||||
}
|
}
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ where
|
|||||||
|
|
||||||
import GHCup.Errors
|
import GHCup.Errors
|
||||||
import GHCup.Types
|
import GHCup.Types
|
||||||
|
import GHCup.Types.Optics
|
||||||
import GHCup.Types.JSON ( )
|
import GHCup.Types.JSON ( )
|
||||||
import GHCup.Utils.Dirs
|
import GHCup.Utils.Dirs
|
||||||
import GHCup.Utils.File
|
import GHCup.Utils.File
|
||||||
@ -262,21 +263,20 @@ unpackToDir dest av = do
|
|||||||
------------
|
------------
|
||||||
|
|
||||||
|
|
||||||
-- | Get the tool versions that have this tag.
|
-- | Get the tool version that has this tag. If multiple have it,
|
||||||
getTagged :: GHCupDownloads -> Tool -> Tag -> [Version]
|
-- picks the greatest version.
|
||||||
getTagged av tool tag = toListOf
|
getTagged :: Tag -> AffineFold (Map.Map Version VersionInfo) (Version, VersionInfo)
|
||||||
( ix tool
|
getTagged tag =
|
||||||
% to (Map.filter (\VersionInfo {..} -> elem tag _viTags))
|
( to (Map.filter (\VersionInfo {..} -> elem tag _viTags))
|
||||||
% to Map.keys
|
% to Map.toDescList
|
||||||
% folded
|
% _head
|
||||||
)
|
)
|
||||||
av
|
|
||||||
|
|
||||||
getLatest :: GHCupDownloads -> Tool -> Maybe Version
|
getLatest :: GHCupDownloads -> Tool -> Maybe Version
|
||||||
getLatest av tool = headOf folded $ getTagged av tool Latest
|
getLatest av tool = headOf (ix tool % getTagged Latest % to fst) $ av
|
||||||
|
|
||||||
getRecommended :: GHCupDownloads -> Tool -> Maybe Version
|
getRecommended :: GHCupDownloads -> Tool -> Maybe Version
|
||||||
getRecommended av tool = headOf folded $ getTagged av tool Recommended
|
getRecommended av tool = headOf (ix tool % getTagged Recommended % to fst) $ av
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -372,3 +372,15 @@ darwinNotarization Darwin path = exec
|
|||||||
Nothing
|
Nothing
|
||||||
Nothing
|
Nothing
|
||||||
darwinNotarization _ _ = pure $ Right ()
|
darwinNotarization _ _ = pure $ Right ()
|
||||||
|
|
||||||
|
|
||||||
|
getChangeLog :: GHCupDownloads -> Tool -> Either Version Tag -> Maybe URI
|
||||||
|
getChangeLog dls tool (Left v') =
|
||||||
|
preview (ix tool % ix v' % viChangeLog % _Just) dls
|
||||||
|
getChangeLog dls tool (Right tag) = preview
|
||||||
|
( ix tool
|
||||||
|
% getTagged tag
|
||||||
|
% to snd
|
||||||
|
% viChangeLog
|
||||||
|
% _Just
|
||||||
|
) dls
|
||||||
|
Loading…
Reference in New Issue
Block a user