@@ -197,9 +197,11 @@ commandLineHandler currentDir progName isInterpreter = complicatedOptions
197
197
buildCmd
198
198
(buildOptsParser Install )
199
199
addCommand' " uninstall"
200
- " DEPRECATED: This command performs no actions, and is present for documentation only"
200
+ (unwords [ " Show how to uninstall Stack. This command does not"
201
+ , " itself uninstall Stack."
202
+ ] )
201
203
uninstallCmd
202
- (many $ strArgument $ metavar " IGNORED " )
204
+ (pure () )
203
205
addBuildCommand' " test"
204
206
" Shortcut for 'build --test'"
205
207
buildCmd
@@ -575,15 +577,33 @@ buildCmd opts = do
575
577
Install -> set (globalOptsBuildOptsMonoidL. buildOptsMonoidInstallExesL) (Just True )
576
578
Build -> id -- Default case is just Build
577
579
578
- uninstallCmd :: [String ] -> RIO Runner ()
579
- uninstallCmd _ = do
580
- prettyErrorL
581
- [ flow " stack does not manage installations in global locations."
582
- , flow " The only global mutation stack performs is executable copying."
583
- , flow " For the default executable destination, please run"
584
- , PP. style Shell " stack path --local-bin"
585
- ]
586
- liftIO exitFailure
580
+ -- | Display help for the uninstall command.
581
+ uninstallCmd :: () -> RIO Runner ()
582
+ uninstallCmd () = withConfig NoReexec $ do
583
+ stackRoot <- view stackRootL
584
+ programsDir <- view $ configL. to configLocalProgramsBase
585
+ localBinDir <- view $ configL. to configLocalBin
586
+ let toStyleDoc = PP. style Dir . fromString . toFilePath
587
+ stackRoot' = toStyleDoc stackRoot
588
+ programsDir' = toStyleDoc programsDir
589
+ localBinDir' = toStyleDoc localBinDir
590
+ prettyInfo $ vsep
591
+ [ flow " To uninstall Stack, it should be sufficient to delete:"
592
+ , hang 4 $ fillSep [flow " (1) the directory containing Stack's tools" ,
593
+ " (" <> softbreak <> programsDir' <> softbreak <> " );" ]
594
+ , hang 4 $ fillSep [flow " (2) the Stack root directory" ,
595
+ " (" <> softbreak <> stackRoot' <> softbreak <> " );" , " and" ]
596
+ , hang 4 $ fillSep [flow " (3) the 'stack' executable file (see the output" ,
597
+ flow " of command" , howToFindStack <> " ," , flow " if Stack is on the PATH;" ,
598
+ flow " Stack is often installed in" , localBinDir' <> softbreak <> " )." ]
599
+ , fillSep [flow " You may also want to delete" , PP. style File " .stack-work" ,
600
+ flow " directories in any Haskell projects that you have built." ]
601
+ ]
602
+ where
603
+ styleShell = PP. style Shell
604
+ howToFindStack
605
+ | osIsWindows = styleShell " where.exe stack"
606
+ | otherwise = styleShell " which stack"
587
607
588
608
-- | Unpack packages to the filesystem
589
609
unpackCmd :: ([String ], Maybe Text ) -> RIO Runner ()
0 commit comments