aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apps/AddPath.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/AddPath.hs
parentput modules to 'Windows' (diff)
downloadwindows-env-be9299d2dc8e0a9e76fe6f07cabb15c144999710.tar.gz
windows-env-be9299d2dc8e0a9e76fe6f07cabb15c144999710.zip
refactoring
Diffstat (limited to 'apps/AddPath.hs')
-rw-r--r--apps/AddPath.hs20
1 files changed, 10 insertions, 10 deletions
diff --git a/apps/AddPath.hs b/apps/AddPath.hs
index db0dcc2..343207c 100644
--- a/apps/AddPath.hs
+++ b/apps/AddPath.hs
@@ -9,12 +9,12 @@ module Main (main) where
import Control.Monad (void, when)
import Data.List (union)
import Data.Maybe (fromMaybe)
-import Text.Printf (printf)
import Options.Applicative
import qualified Windows.Environment as Env
-import qualified Utils
+import Banner
+import Prompt
data Options = Options
{ optName :: Env.VarName
@@ -56,18 +56,18 @@ addPath options = do
let newPaths = union oldPaths pathsToAdd
when (length oldPaths /= length newPaths) $ do
let newValue = Env.pathJoin newPaths
- let promptBanner = Utils.engraveBanner profile varName oldValue newValue
- void $ prompt promptBanner $ Env.engrave profile varName newValue
+ let banner = engraveBanner profile varName oldValue newValue
+ void $ prompt banner $ Env.engrave profile varName newValue
where
varName = optName options
pathsToAdd = optPaths 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