Commit 8bfea3ba authored by Mikhail Glushenkov's avatar Mikhail Glushenkov

Implement a dummy 'uninstall' command.

As suggested by @sclv on reddit. See
https://github.com/haskell/cabal/issues/648#issuecomment-96895441
parent f2d01e5a
......@@ -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",
......
......@@ -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) $
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment