diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-07-11 19:11:23 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-07-11 19:11:23 +0300 |
commit | 7b3fd9218596a2d7a14a92625a4d62c9a7b7b0f6 (patch) | |
tree | 8195393c18d0cdd3d9ebcdadb014d75285bfaf7e /apps/AddPath.hs | |
parent | become a proper stack project (diff) | |
download | windows-env-7b3fd9218596a2d7a14a92625a4d62c9a7b7b0f6.tar.gz windows-env-7b3fd9218596a2d7a14a92625a4d62c9a7b7b0f6.zip |
rename modules + fix compiler warnings
Diffstat (limited to '')
-rw-r--r-- | apps/AddPath.hs | 16 |
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" ] |