From d0039e24561a791d424da751894b02a9994e1fd6 Mon Sep 17 00:00:00 2001
From: Alexis Williams <alexis@typedr.at>
Date: Sun, 16 Dec 2018 11:14:24 -0800
Subject: [PATCH] Musical chairs to switch defaults to 'v2' commands.

---
 .../Distribution/Client/CmdLegacy.hs          | 24 +++++++------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/cabal-install/Distribution/Client/CmdLegacy.hs b/cabal-install/Distribution/Client/CmdLegacy.hs
index d93b6e2ff1..faecea5d77 100644
--- a/cabal-install/Distribution/Client/CmdLegacy.hs
+++ b/cabal-install/Distribution/Client/CmdLegacy.hs
@@ -130,10 +130,8 @@ legacyNote cmd = wrapText $
     "For more information, see: https://wiki.haskell.org/Cabal/NewBuild\n"
 
 toLegacyCmd :: (Bool -> CommandSpec (globals -> IO action)) -> [CommandSpec (globals -> IO action)]
-toLegacyCmd mkSpec = [toDeprecated (mkSpec True), toLegacy (mkSpec False)]
+toLegacyCmd mkSpec = [toLegacy (mkSpec False)]
     where
-        legacyMsg = T.unpack . T.replace "v1-" "" . T.pack
-
         toLegacy (CommandSpec origUi@CommandUI{..} action type') = CommandSpec legUi action type'
             where
                 legUi = origUi
@@ -143,17 +141,6 @@ toLegacyCmd mkSpec = [toDeprecated (mkSpec True), toLegacy (mkSpec False)]
                         Nothing -> legacyNote commandName
                     }
 
-        toDeprecated (CommandSpec origUi@CommandUI{..} action type') = CommandSpec depUi action type'
-            where
-                depUi = origUi
-                    { commandName = legacyMsg commandName
-                    , commandUsage = legacyMsg . commandUsage
-                    , commandDescription = (legacyMsg .) <$> commandDescription
-                    , commandNotes = Just $ \pname -> case commandNotes of
-                        Just notes -> legacyMsg (notes pname) ++ "\n" ++ deprecationNote commandName
-                        Nothing -> deprecationNote commandName
-                    }
-
 legacyCmd :: (HasVerbosity flags) => CommandUI flags -> (flags -> [String] -> globals -> IO action) -> [CommandSpec (globals -> IO action)]
 legacyCmd ui action = toLegacyCmd (regularCmd ui action)
 
@@ -161,7 +148,7 @@ legacyWrapperCmd :: Monoid flags => CommandUI flags -> (flags -> Setup.Flag Verb
 legacyWrapperCmd ui verbosity' distPref = toLegacyCmd (wrapperCmd ui verbosity' distPref)
 
 newCmd :: CommandUI flags -> (flags -> [String] -> globals -> IO action) -> [CommandSpec (globals -> IO action)]
-newCmd origUi@CommandUI{..} action = [cmd v2Ui, cmd origUi]
+newCmd origUi@CommandUI{..} action = [cmd defaultUi, cmd v2Ui, cmd origUi]
     where
         cmd ui = CommandSpec ui (flip commandAddAction action) NormalCommand
         v2Msg = T.unpack . T.replace "new-" "v2-" . T.pack
@@ -171,3 +158,10 @@ newCmd origUi@CommandUI{..} action = [cmd v2Ui, cmd origUi]
             , commandDescription = (v2Msg .) <$> commandDescription
             , commandNotes = (v2Msg .) <$> commandDescription
             }
+        defaultMsg = T.unpack . T.replace "new-" "" . T.pack
+        defaultUi = origUi 
+            { commandName = defaultMsg commandName
+            , commandUsage = defaultMsg . commandUsage
+            , commandDescription = (defaultMsg .) <$> commandDescription
+            , commandNotes = (defaultMsg .) <$> commandDescription
+            }
-- 
GitLab