aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apps/AddPath.hs
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2017-01-25 07:12:39 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2017-01-25 07:12:39 +0300
commit44a7cce93547336293745f3c750b046680195ffe (patch)
tree6c959ec6aff111c34f0fec92fa008a97c7bf4b1d /apps/AddPath.hs
parentrename namespace 'Windows' to 'WindowsEnv' (diff)
downloadwindows-env-44a7cce93547336293745f3c750b046680195ffe.tar.gz
windows-env-44a7cce93547336293745f3c750b046680195ffe.zip
add a dummy module for re-exports
Diffstat (limited to 'apps/AddPath.hs')
-rw-r--r--apps/AddPath.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/apps/AddPath.hs b/apps/AddPath.hs
index 0439873..73d86d0 100644
--- a/apps/AddPath.hs
+++ b/apps/AddPath.hs
@@ -14,16 +14,16 @@ import System.IO.Error (ioError, isDoesNotExistError)
import Options.Applicative
-import qualified WindowsEnv.Environment as Env
+import qualified WindowsEnv
import Prompt
import PromptMessage
data Options = Options
- { optName :: Env.VarName
+ { optName :: WindowsEnv.VarName
, optYes :: Bool
, optGlobal :: Bool
- , optPaths :: [Env.VarValue]
+ , optPaths :: [WindowsEnv.VarValue]
} deriving (Eq, Show)
optionParser :: Parser Options
@@ -61,8 +61,8 @@ addPath options = runExceptT doAddPath >>= either ioError return
forAllUsers = optGlobal options
profile
- | forAllUsers = Env.AllUsers
- | otherwise = Env.CurrentUser
+ | forAllUsers = WindowsEnv.AllUsers
+ | otherwise = WindowsEnv.CurrentUser
skipPrompt = optYes options
@@ -71,13 +71,13 @@ addPath options = runExceptT doAddPath >>= either ioError return
| otherwise = throwE e
doAddPath = do
- oldValue <- Env.query profile varName `catchE` emptyIfMissing
- let oldPaths = Env.pathSplit oldValue
+ oldValue <- WindowsEnv.query profile varName `catchE` emptyIfMissing
+ let oldPaths = WindowsEnv.pathSplit oldValue
let newPaths = oldPaths `union` pathsToAdd
when (length oldPaths /= length newPaths) $ do
- let newValue = Env.pathJoin newPaths
+ let newValue = WindowsEnv.pathJoin newPaths
let promptAnd = if skipPrompt
then withoutPrompt
else withPrompt $ oldNewMessage profile varName oldValue newValue
- let engrave = Env.engrave profile varName newValue
+ let engrave = WindowsEnv.engrave profile varName newValue
void $ promptAnd engrave