aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apps/AddPath.hs
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-07-11 19:11:23 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-07-11 19:11:23 +0300
commit7b3fd9218596a2d7a14a92625a4d62c9a7b7b0f6 (patch)
tree8195393c18d0cdd3d9ebcdadb014d75285bfaf7e /apps/AddPath.hs
parentbecome a proper stack project (diff)
downloadwindows-env-7b3fd9218596a2d7a14a92625a4d62c9a7b7b0f6.tar.gz
windows-env-7b3fd9218596a2d7a14a92625a4d62c9a7b7b0f6.zip
rename modules + fix compiler warnings
Diffstat (limited to '')
-rw-r--r--apps/AddPath.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/apps/AddPath.hs b/apps/AddPath.hs
index e17adc9..558c23c 100644
--- a/apps/AddPath.hs
+++ b/apps/AddPath.hs
@@ -12,7 +12,7 @@ import System.Environment ( getArgs, getProgName )
import System.Exit ( exitFailure, exitSuccess )
import System.IO ( hPutStr, stderr )
-import qualified EnvUtils
+import qualified Environment
main :: IO ()
main = do
@@ -27,20 +27,20 @@ addPath :: [String] -> Options -> IO ()
addPath paths options = do
missingPaths <- dropIncludedPaths paths
when (not $ null missingPaths) $ do
- oldPath <- EnvUtils.queryFromRegistry (env options) (name options)
- EnvUtils.saveToRegistryWithPrompt (env options) (name options) $ EnvUtils.joinPaths $ missingPaths ++ [oldPath]
+ oldPath <- Environment.queryFromRegistry (env options) (name options)
+ Environment.saveToRegistryWithPrompt (env options) (name options) $ Environment.joinPaths $ missingPaths ++ [oldPath]
where
dropIncludedPaths paths = do
- currentPath <- EnvUtils.getEnv $ name options
- return $ filter (flip notElem $ EnvUtils.splitPaths currentPath) paths
+ currentPath <- Environment.getEnv $ name options
+ return $ filter (flip notElem $ Environment.splitPaths currentPath) paths
data Options = Options { name :: String
- , env :: EnvUtils.RegistryBasedEnvironment }
+ , env :: Environment.RegistryBasedEnvironment }
deriving (Eq, Show)
defaultOptions :: Options
defaultOptions = Options { name = "PATH"
- , env = EnvUtils.CurrentUserEnvironment }
+ , env = Environment.CurrentUserEnvironment }
buildHelpMessage :: IO String
buildHelpMessage = do
@@ -71,6 +71,6 @@ invalidNumberOfArguments = exitWithUsageErrors ["invalid number of arguments\n"]
optionDescription :: [OptDescr (Options -> IO Options)]
optionDescription = [
Option "n" ["name"] (ReqArg (\s opts -> return opts { name = s }) "NAME") "set the variable name ('PATH' by default)",
- Option "g" ["global"] (NoArg $ \opts -> return opts { env = EnvUtils.AllUsersEnvironment }) "add the path for all users",
+ Option "g" ["global"] (NoArg $ \opts -> return opts { env = Environment.AllUsersEnvironment }) "add the path for all users",
Option "h" ["help"] (NoArg exitWithHelpMessage) "show this message and exit"
]