aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apps/SetEnv.hs
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-07-17 18:24:12 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-07-17 18:24:12 +0300
commitd854f16486913af7fb70e4ff251a29d5cf2d7323 (patch)
treecffae3dc6f90ff96da9b11ddc57d7bf43bc97ad1 /apps/SetEnv.hs
parentupdate project description (diff)
downloadwindows-env-d854f16486913af7fb70e4ff251a29d5cf2d7323.tar.gz
windows-env-d854f16486913af7fb70e4ff251a29d5cf2d7323.zip
refactoring
Diffstat (limited to 'apps/SetEnv.hs')
-rw-r--r--apps/SetEnv.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/SetEnv.hs b/apps/SetEnv.hs
index 18e369f..54a3cde 100644
--- a/apps/SetEnv.hs
+++ b/apps/SetEnv.hs
@@ -44,7 +44,7 @@ main = execParser parser >>= setEnv
fullDesc <> progDesc "Set environment variable"
setEnv :: Options -> IO ()
-setEnv options = engrave env varName varValue
+setEnv options = engrave varValue
where
varName = optName options
varValue = optValue options
@@ -54,6 +54,6 @@ setEnv options = engrave env varName varValue
| otherwise = Environment.CurrentUser
skipPrompt = optYes options
- engrave
- | skipPrompt = Environment.engrave
- | otherwise = Environment.engraveWithPrompt
+ engrave value = if skipPrompt
+ then Environment.engrave env varName value
+ else Environment.engravePrompt env varName value >> return ()