From be9299d2dc8e0a9e76fe6f07cabb15c144999710 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 18 Jul 2016 00:43:21 +0300 Subject: refactoring --- apps/UnsetEnv.hs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'apps/UnsetEnv.hs') 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 -- cgit v1.2.3