aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apps/ListPaths.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/ListPaths.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/ListPaths.hs')
-rw-r--r--apps/ListPaths.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/apps/ListPaths.hs b/apps/ListPaths.hs
index 543599e..666423f 100644
--- a/apps/ListPaths.hs
+++ b/apps/ListPaths.hs
@@ -17,21 +17,21 @@ import System.IO.Error (ioError)
import Options.Applicative
-import qualified WindowsEnv.Environment as Env
+import qualified WindowsEnv
data WhichPaths = All | ExistingOnly | MissingOnly
deriving (Eq, Show)
-shouldListPath :: WhichPaths -> Env.VarValue -> IO Bool
+shouldListPath :: WhichPaths -> WindowsEnv.VarValue -> IO Bool
shouldListPath All = return . const True
shouldListPath ExistingOnly = doesDirectoryExist
shouldListPath MissingOnly = fmap not . doesDirectoryExist
-data Source = Environment | Registry Env.Profile
+data Source = Environment | Registry WindowsEnv.Profile
deriving (Eq, Show)
data Options = Options
- { optName :: Env.VarName
+ { optName :: WindowsEnv.VarName
, optWhichPaths :: WhichPaths
, optSource :: Source
} deriving (Eq, Show)
@@ -52,9 +52,9 @@ optionParser = Options
<|> flag' MissingOnly (long "missing" <> short 'm'
<> help "List missing paths only")
optSourceDesc = pure Environment
- <|> flag' (Registry Env.CurrentUser) (long "user" <> short 'u'
+ <|> flag' (Registry WindowsEnv.CurrentUser) (long "user" <> short 'u'
<> help "List current user's paths only")
- <|> flag' (Registry Env.AllUsers) (long "global" <> short 'g'
+ <|> flag' (Registry WindowsEnv.AllUsers) (long "global" <> short 'g'
<> help "List global (all users') paths only")
main :: IO ()
@@ -73,12 +73,12 @@ listPaths options = runExceptT doListPaths >>= either ioError return
query = queryFrom source
queryFrom Environment = lift $ fromMaybe "" <$> lookupEnv varName
- queryFrom (Registry profile) = Env.query profile varName
+ queryFrom (Registry profile) = WindowsEnv.query profile varName
filterPaths = filterM $ shouldListPath whichPaths
doListPaths = do
- paths <- Env.pathSplit <$> query
+ paths <- WindowsEnv.pathSplit <$> query
lift $ do
pathsToPrint <- filterPaths paths
mapM_ putStrLn pathsToPrint