diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-07-18 00:17:44 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-07-18 00:17:44 +0300 |
commit | 427ae9ad54492954578cafbfcd2d815a084e0986 (patch) | |
tree | e81cdbf3b9f4d06c921f81a08264b214381d3c8a /apps/RemovePath.hs | |
parent | refactoring (diff) | |
download | windows-env-427ae9ad54492954578cafbfcd2d815a084e0986.tar.gz windows-env-427ae9ad54492954578cafbfcd2d815a084e0986.zip |
put modules to 'Windows'
Diffstat (limited to 'apps/RemovePath.hs')
-rw-r--r-- | apps/RemovePath.hs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/apps/RemovePath.hs b/apps/RemovePath.hs index a594ecd..ecc56c0 100644 --- a/apps/RemovePath.hs +++ b/apps/RemovePath.hs @@ -10,17 +10,16 @@ import Control.Monad (void, when) import Data.List ((\\)) import Data.Maybe (fromJust, isJust) -import Options.Applicative - -import qualified Environment +import Options.Applicative +import qualified Windows.Environment as Env import qualified Utils data Options = Options - { optName :: Environment.VarName + { optName :: Env.VarName , optYes :: Bool , optGlobal :: Bool - , optPaths :: [Environment.VarValue] + , optPaths :: [Env.VarValue] } deriving (Eq, Show) options = Options @@ -50,9 +49,9 @@ main = execParser parser >>= removePath removePath :: Options -> IO () removePath options = do - removePathFrom Environment.CurrentUser + removePathFrom Env.CurrentUser when forAllUsers $ do - removePathFrom Environment.AllUsers + removePathFrom Env.AllUsers where varName = optName options pathsToRemove = optPaths options @@ -60,14 +59,14 @@ removePath options = do forAllUsers = optGlobal options removePathFrom profile = do - oldValue <- Environment.query profile varName + oldValue <- Env.query profile varName when (isJust oldValue) $ do - let oldPaths = Environment.pathSplit $ fromJust oldValue + let oldPaths = Env.pathSplit $ fromJust oldValue let newPaths = oldPaths \\ pathsToRemove when (length oldPaths /= length newPaths) $ do - let newValue = Environment.pathJoin newPaths + let newValue = Env.pathJoin newPaths let promptBanner = Utils.engraveBanner profile varName oldValue newValue - void $ prompt promptBanner $ Environment.engrave profile varName newValue + void $ prompt promptBanner $ Env.engrave profile varName newValue skipPrompt = optYes options prompt = if skipPrompt |