aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apps/SetEnv.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/SetEnv.hs
parentput modules to 'Windows' (diff)
downloadwindows-env-be9299d2dc8e0a9e76fe6f07cabb15c144999710.tar.gz
windows-env-be9299d2dc8e0a9e76fe6f07cabb15c144999710.zip
refactoring
Diffstat (limited to 'apps/SetEnv.hs')
-rw-r--r--apps/SetEnv.hs19
1 files changed, 10 insertions, 9 deletions
diff --git a/apps/SetEnv.hs b/apps/SetEnv.hs
index a48fbe6..e94e350 100644
--- a/apps/SetEnv.hs
+++ b/apps/SetEnv.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
@@ -47,19 +48,19 @@ main = execParser parser >>= setEnv
fullDesc <> progDesc "Set environment variable"
setEnv :: Options -> IO ()
-setEnv options = void $ prompt confirmationBanner $ Env.engrave profile varName varValue
+setEnv options = void $ prompt banner $ Env.engrave profile varName varValue
where
- confirmationBanner = Utils.engraveBanner profile varName Nothing varValue
+ banner = engraveBanner profile varName Nothing varValue
varName = optName options
varValue = optValue 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