aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apps/UnsetEnv.hs
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-07-18 00:43:21 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-07-18 00:43:21 +0300
commitbe9299d2dc8e0a9e76fe6f07cabb15c144999710 (patch)
tree91a68cd35e78c612eb358181f24e91fda904e766 /apps/UnsetEnv.hs
parentput modules to 'Windows' (diff)
downloadwindows-env-be9299d2dc8e0a9e76fe6f07cabb15c144999710.tar.gz
windows-env-be9299d2dc8e0a9e76fe6f07cabb15c144999710.zip
refactoring
Diffstat (limited to '')
-rw-r--r--apps/UnsetEnv.hs19
1 files changed, 10 insertions, 9 deletions
diff --git a/apps/UnsetEnv.hs b/apps/UnsetEnv.hs
index 88101d9..eebef00 100644
--- a/apps/UnsetEnv.hs
+++ b/apps/UnsetEnv.hs
@@ -11,7 +11,8 @@ import Control.Monad (void)
import Options.Applicative
import qualified Windows.Environment as Env
-import qualified Utils
+import Banner
+import Prompt
data Options = Options
{ optYes :: Bool
@@ -42,18 +43,18 @@ main = execParser parser >>= unsetEnv
fullDesc <> progDesc "Unset environment variable"
unsetEnv :: Options -> IO ()
-unsetEnv options = void $ prompt confirmationBanner $ Env.wipe profile varName
+unsetEnv options = void $ prompt banner $ Env.wipe profile varName
where
- confirmationBanner = Utils.wipeBanner profile varName
+ banner = wipeBanner profile varName
varName = optName options
forAllUsers = optGlobal options
- profile = if forAllUsers
- then Env.AllUsers
- else Env.CurrentUser
+ profile
+ | forAllUsers = Env.AllUsers
+ | otherwise = Env.CurrentUser
skipPrompt = optYes options
- prompt = if skipPrompt
- then const Utils.withoutPrompt
- else Utils.withPrompt
+ prompt
+ | skipPrompt = const withoutPrompt
+ | otherwise = withPrompt