From 150cd57cb42acff553076f0bc3a231d291d174f4 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 19 Jul 2016 03:47:25 +0300 Subject: refactoring --- apps/ListPath.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/ListPath.hs b/apps/ListPath.hs index 03c0e68..086a219 100644 --- a/apps/ListPath.hs +++ b/apps/ListPath.hs @@ -40,8 +40,14 @@ listPath options = do query = liftM (fromMaybe "") $ lookupEnv varName + prefix exists + | exists = "+ " + | otherwise = "- " + + formatPath exists path = prefix exists ++ path + printPath path = do exists <- doesDirectoryExist path - putStrLn $ (if exists then "+" else "-") ++ " " ++ path + putStrLn $ formatPath exists path printPaths = mapM_ printPath -- cgit v1.2.3