diff --git a/cabal-install/Distribution/Client/Setup.hs b/cabal-install/Distribution/Client/Setup.hs index fd836d93e5b..a87a3c6b4e0 100644 --- a/cabal-install/Distribution/Client/Setup.hs +++ b/cabal-install/Distribution/Client/Setup.hs @@ -22,6 +22,7 @@ module Distribution.Client.Setup , listCommand, ListFlags(..) , updateCommand , upgradeCommand + , uninstallCommand , infoCommand, InfoFlags(..) , fetchCommand, FetchFlags(..) , freezeCommand, FreezeFlags(..) @@ -837,6 +838,17 @@ formatCommand = CommandUI { commandOptions = \_ -> [] } +uninstallCommand :: CommandUI (Flag Verbosity) +uninstallCommand = CommandUI { + commandName = "uninstall", + commandSynopsis = "Warn about 'uninstall' not being implemented.", + commandDescription = Nothing, + commandNotes = Nothing, + commandUsage = usageAlternatives "uninstall" ["PACKAGES"], + commandDefaultFlags = toFlag normal, + commandOptions = \_ -> [] + } + runCommand :: CommandUI (BuildFlags, BuildExFlags) runCommand = CommandUI { commandName = "run", diff --git a/cabal-install/Main.hs b/cabal-install/Main.hs index 09a79f0e713..bedfea49448 100644 --- a/cabal-install/Main.hs +++ b/cabal-install/Main.hs @@ -22,7 +22,7 @@ import Distribution.Client.Setup , BuildFlags(..), BuildExFlags(..), SkipAddSourceDepsCheck(..) , buildCommand, replCommand, testCommand, benchmarkCommand , InstallFlags(..), defaultInstallFlags - , installCommand, upgradeCommand + , installCommand, upgradeCommand, uninstallCommand , FetchFlags(..), fetchCommand , FreezeFlags(..), freezeCommand , GetFlags(..), getCommand, unpackCommand @@ -254,6 +254,8 @@ mainWorker args = topHandler $ regVerbosity regDistPref ,testCommand `commandAddAction` testAction ,benchmarkCommand `commandAddAction` benchmarkAction + ,hiddenCommand $ + uninstallCommand `commandAddAction` uninstallAction ,hiddenCommand $ formatCommand `commandAddAction` formatAction ,hiddenCommand $ @@ -1004,6 +1006,17 @@ formatAction verbosityFlag extraArgs _globalFlags = do -- Uses 'writeFileAtomic' under the hood. writeGenericPackageDescription path pkgDesc +uninstallAction :: Flag Verbosity -> [String] -> GlobalFlags -> IO () +uninstallAction _verbosityFlag extraArgs _globalFlags = do + let package = case extraArgs of + p:_ -> p + _ -> "PACKAGE_NAME" + die $ "This version of 'cabal-install' does not support the 'uninstall' operation. " + ++ "It will likely be implemented at some point in the future; in the meantime " + ++ "you're advised to use either 'ghc-pkg unregister " ++ package ++ "' or " + ++ "'cabal sandbox hc-pkg -- unregister " ++ package ++ "'." + + sdistAction :: (SDistFlags, SDistExFlags) -> [String] -> GlobalFlags -> IO () sdistAction (sdistFlags, sdistExFlags) extraArgs _globalFlags = do unless (null extraArgs) $