diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-12-12 11:26:09 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-12-12 11:26:09 +0300 |
commit | f137d82adf8b02db3519c018373b18059bac486e (patch) | |
tree | 8f14a6079f8357d56f9b9450a038d6f64bffe9c4 /apps | |
parent | refactoring (diff) | |
download | windows-env-f137d82adf8b02db3519c018373b18059bac486e.tar.gz windows-env-f137d82adf8b02db3519c018373b18059bac486e.zip |
refactoring
Diffstat (limited to '')
-rw-r--r-- | apps/AddPath.hs | 6 | ||||
-rw-r--r-- | apps/RemovePath.hs | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/apps/AddPath.hs b/apps/AddPath.hs index 9f9a5b1..a32244c 100644 --- a/apps/AddPath.hs +++ b/apps/AddPath.hs @@ -52,7 +52,7 @@ main = execParser parser >>= addPath addPath :: Options -> IO () addPath options = do - oldValue <- Env.query profile varName >>= emptyIfNotFound + oldValue <- Env.query profile varName >>= emptyIfMissing let oldPaths = Env.pathSplit oldValue let newPaths = oldPaths `union` pathsToAdd when (length oldPaths /= length newPaths) $ do @@ -73,7 +73,7 @@ addPath options = do skipPrompt = optYes options - emptyIfNotFound (Left e) + emptyIfMissing (Left e) | isDoesNotExistError e = return "" | otherwise = ioError e - emptyIfNotFound (Right s) = return s + emptyIfMissing (Right s) = return s diff --git a/apps/RemovePath.hs b/apps/RemovePath.hs index 2956517..eb1cb00 100644 --- a/apps/RemovePath.hs +++ b/apps/RemovePath.hs @@ -63,7 +63,9 @@ removePath options = do skipPrompt = optYes options - removePathFrom profile = Env.query profile varName >>= either ignoreMissing (doRemovePathFrom profile) + removePathFrom profile = do + oldValue <- Env.query profile varName + either ignoreMissing (doRemovePathFrom profile) oldValue ignoreMissing e | isDoesNotExistError e = return () |