aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--app/ListPaths.hs4
-rw-r--r--app/RemovePath.hs3
-rw-r--r--app/SetEnv.hs5
-rw-r--r--app/UnsetEnv.hs10
4 files changed, 11 insertions, 11 deletions
diff --git a/app/ListPaths.hs b/app/ListPaths.hs
index c507d39..0c8483c 100644
--- a/app/ListPaths.hs
+++ b/app/ListPaths.hs
@@ -70,7 +70,9 @@ listPaths options = runExceptT doListPaths >>= either ioError return
query = queryFrom $ optSource options
- queryFrom Environment = lift $ WindowsEnv.Value False <$> fromMaybe "" <$> lookupEnv varName
+ queryFrom Environment = lift $ WindowsEnv.Value False
+ <$> fromMaybe ""
+ <$> lookupEnv varName
queryFrom (Registry profile) = WindowsEnv.query profile varName
doListPaths = do
diff --git a/app/RemovePath.hs b/app/RemovePath.hs
index a8bf56d..56ea66f 100644
--- a/app/RemovePath.hs
+++ b/app/RemovePath.hs
@@ -72,7 +72,8 @@ removePath options = runExceptT doRemovePath >>= either ioError return
removePathFrom profile = do
oldValue <- WindowsEnv.query profile varName
let expandable = WindowsEnv.valueExpandable oldValue
- let split = WindowsEnv.pathSplit $ WindowsEnv.valueString oldValue
+ let joined = WindowsEnv.valueString oldValue
+ let split = WindowsEnv.pathSplit joined
let remaining = filter (flip notElem pathsToRemove) split
when (length split /= length remaining) $ do
let newValue = WindowsEnv.Value expandable (WindowsEnv.pathJoin remaining)
diff --git a/app/SetEnv.hs b/app/SetEnv.hs
index e77b05a..6932198 100644
--- a/app/SetEnv.hs
+++ b/app/SetEnv.hs
@@ -56,14 +56,13 @@ setEnv options = runExceptT doSetEnv >>= either ioError return
where
varName = optName options
varValue = optValue options
-
forAllUsers = optGlobal options
+ skipPrompt = optYes options
+
profile
| forAllUsers = WindowsEnv.AllUsers
| otherwise = WindowsEnv.CurrentUser
- skipPrompt = optYes options
-
doSetEnv = do
expanded <- WindowsEnv.expand varValue
let expandable = expanded /= varValue
diff --git a/app/UnsetEnv.hs b/app/UnsetEnv.hs
index 02df1a1..b841f86 100644
--- a/app/UnsetEnv.hs
+++ b/app/UnsetEnv.hs
@@ -50,17 +50,15 @@ unsetEnv :: Options -> IO ()
unsetEnv options = runExceptT doUnsetEnv >>= either ioError return
where
varName = optName options
-
forAllUsers = optGlobal options
+ skipPrompt = optYes options
+
profile
| forAllUsers = WindowsEnv.AllUsers
| otherwise = WindowsEnv.CurrentUser
- skipPrompt = optYes options
+ doUnsetEnv = void $ promptAnd $ WindowsEnv.wipe profile varName
+
promptAnd
| skipPrompt = withoutPrompt
| otherwise = withPrompt $ wipeMessage profile varName
-
- wipe = WindowsEnv.wipe profile varName
-
- doUnsetEnv = void $ promptAnd wipe