From c9216fb44478b2b5c953a87c6a9bd04a5e50ac02 Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@posteo.de>
Date: Sat, 29 Jan 2022 20:02:33 +0100
Subject: [PATCH] Improve help output of hls compile

---
 app/ghcup/GHCup/OptParse/Common.hs  | 12 ------------
 app/ghcup/GHCup/OptParse/Compile.hs |  7 ++++++-
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/app/ghcup/GHCup/OptParse/Common.hs b/app/ghcup/GHCup/OptParse/Common.hs
index 64e2d6a2..49e96576 100644
--- a/app/ghcup/GHCup/OptParse/Common.hs
+++ b/app/ghcup/GHCup/OptParse/Common.hs
@@ -89,18 +89,6 @@ toolVersionArgument criteria tool =
   mv _          = "VERSION|TAG"
 
 
-toolVersionOption :: Maybe ListCriteria -> Maybe Tool -> Parser ToolVersion
-toolVersionOption criteria tool =
-  option (eitherReader toolVersionEither)
-    (  sh tool
-    <> completer (tagCompleter (fromMaybe GHC tool) [])
-    <> foldMap (completer . versionCompleter criteria) tool)
- where
-  sh (Just GHC) = long "ghc" <> metavar "GHC_VERSION|TAG"
-  sh (Just HLS) = long "hls" <> metavar "HLS_VERSION|TAG"
-  sh _          = long "version" <> metavar "VERSION|TAG"
-
-
 versionParser :: Parser GHCTargetVersion
 versionParser = option
   (eitherReader tVersionEither)
diff --git a/app/ghcup/GHCup/OptParse/Compile.hs b/app/ghcup/GHCup/OptParse/Compile.hs
index ca7867b3..fda68109 100644
--- a/app/ghcup/GHCup/OptParse/Compile.hs
+++ b/app/ghcup/GHCup/OptParse/Compile.hs
@@ -340,7 +340,12 @@ hlsCompileOpts =
             )
           )
         )
-    <*> some (toolVersionOption Nothing (Just GHC))
+    <*> some (
+          option (eitherReader toolVersionEither)
+            (  long "ghc" <> metavar "GHC_VERSION|TAG" <> help "For which GHC version to compile for (can be specified multiple times)"
+            <> completer (tagCompleter GHC [])
+            <> completer (versionCompleter Nothing GHC))
+        )
     <*> many (argument str (metavar "CABAL_ARGS" <> help "Additional arguments to cabal install, prefix with '-- ' (longopts)"))
 
 
-- 
GitLab