Skip to content

Commit

Permalink
Mode: rename GHC to Global
Browse files Browse the repository at this point in the history
  • Loading branch information
juhp committed Sep 13, 2023
1 parent e58949e commit 8e2d2ed
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import Paths_stack_clean_old (version)
import Snapshots
import Types

data Mode = Default | Project | Snapshots | Compilers | GHC | Tarballs
data Mode = Default | Project | Snapshots | Compilers | Global | Tarballs

data Recursion = Subdirs | Recursive
deriving Eq
Expand Down Expand Up @@ -80,7 +80,7 @@ main = do
flagWith' Snapshots 'S' "snapshots" ("Act on " ++ stackroot </> "snapshots/") <|>
flagWith' Compilers 'C' "compilers" ("Act on " ++ stackroot </> "programs/ installations") <|>
flagWith' Tarballs 'T' "tarballs" ("Act on " ++ stackroot </> "programs/ tarballs") <|>
flagWith Default GHC 'G' "global" ("Act on both " ++ stackroot </> "{programs,snapshots}/ [default outside project dir]")
flagWith Default Global 'G' "global" ("Act on both " ++ stackroot </> "{programs,snapshots}/ [default outside project dir]")

deleteOpt = flagWith Dryrun Delete 'd' "delete" "Do deletion [default is dryrun]"

Expand Down Expand Up @@ -130,14 +130,14 @@ sizeCmd mode mrecursion notHuman msystem =
Snapshots -> sizeSnapshots notHuman msystem
Compilers -> sizeGhcPrograms notHuman
Tarballs -> error' "use --compilers"
GHC -> do
Global -> do
sizeCmd Snapshots Nothing notHuman msystem
sizeCmd Compilers Nothing notHuman msystem
Default -> do
isProject <- doesDirectoryExist ".stack-work"
if isProject || isJust mrecursion
then sizeCmd Project mrecursion notHuman msystem
else sizeCmd GHC Nothing notHuman msystem
else sizeCmd Global Nothing notHuman msystem

listCmd :: Mode -> Maybe Recursion -> Maybe Version -> Maybe String -> IO ()
listCmd mode mrecursion mver msystem =
Expand All @@ -147,14 +147,14 @@ listCmd mode mrecursion mver msystem =
Snapshots -> getStackSubdir "snapshots" >>= listGhcSnapshots msystem mver
Compilers -> listGhcInstallation mver msystem
Tarballs -> listGhcTarballs mver msystem
GHC -> do
Global -> do
listCmd Snapshots Nothing mver msystem
listCmd Compilers Nothing mver msystem
Default -> do
isProject <- doesDirectoryExist ".stack-work"
if isProject
then listCmd Project Nothing mver msystem
else listCmd GHC Nothing mver msystem
else listCmd Global Nothing mver msystem

removeCmd :: Deletion -> Mode -> Maybe Recursion -> Version -> Maybe String
-> IO ()
Expand All @@ -179,14 +179,14 @@ removeRun deletion mode mrecursion ghcver msystem =
removeGhcVersionInstallation deletion ghcver msystem
Tarballs -> do
removeGhcVersionTarball deletion ghcver msystem
GHC -> do
Global -> do
removeRun deletion Compilers Nothing ghcver msystem
removeRun deletion Snapshots Nothing ghcver msystem
Default -> do
isProject <- doesDirectoryExist ".stack-work"
if isProject
then removeRun deletion Project Nothing ghcver msystem
else removeRun deletion GHC Nothing ghcver msystem
else removeRun deletion Global Nothing ghcver msystem

removeMinorsCmd :: Deletion -> Mode -> Maybe Recursion -> Maybe Version
-> Maybe String -> IO ()
Expand All @@ -209,14 +209,14 @@ removeMinorsRun deletion mode mrecursion mver msystem = do
cleanMinorSnapshots deletion cwd mver
Compilers -> removeGhcMinorInstallation deletion mver msystem
Tarballs -> removeGhcMinorTarball deletion mver msystem
GHC -> do
Global -> do
removeMinorsRun deletion Compilers Nothing mver msystem
removeMinorsRun deletion Snapshots Nothing mver msystem
Default -> do
isProject <- doesDirectoryExist ".stack-work"
if isProject
then removeMinorsRun deletion Project Nothing mver msystem
else removeMinorsRun deletion GHC Nothing mver msystem
else removeMinorsRun deletion Global Nothing mver msystem

purgeOlderCmd :: Deletion -> Natural -> Maybe Recursion -> Maybe String -> IO ()
purgeOlderCmd deletion keep mrecursion msystem = do
Expand Down

0 comments on commit 8e2d2ed

Please sign in to comment.