aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/app/Utils/PromptMessage.hs
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2017-06-12 20:52:55 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2017-06-12 20:52:55 +0300
commitdb65042293d2d5a7235dbdf428cec2f23d46e25a (patch)
tree880511530e26270c497b95efc65245ad194d5dd0 /app/Utils/PromptMessage.hs
parentrefactoring (diff)
downloadwindows-env-db65042293d2d5a7235dbdf428cec2f23d46e25a.tar.gz
windows-env-db65042293d2d5a7235dbdf428cec2f23d46e25a.zip
feature registry value type in prompts
Diffstat (limited to 'app/Utils/PromptMessage.hs')
-rw-r--r--app/Utils/PromptMessage.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/Utils/PromptMessage.hs b/app/Utils/PromptMessage.hs
index 609cb8f..6aa4f72 100644
--- a/app/Utils/PromptMessage.hs
+++ b/app/Utils/PromptMessage.hs
@@ -15,14 +15,19 @@ import Text.Printf (printf)
import qualified WindowsEnv
+valueType :: WindowsEnv.Value -> String
+valueType value
+ | WindowsEnv.valueExpandable value = "REG_EXPAND_SZ"
+ | otherwise = "REG_SZ"
+
oldNewMessage :: WindowsEnv.Profile -> WindowsEnv.Name -> WindowsEnv.Value -> WindowsEnv.Value -> String
oldNewMessage profile name oldValue newValue =
descrMsg ++ oldValueMsg ++ newValueMsg
where
profileKey = WindowsEnv.profileKeyPath profile
descrMsg = printf "Saving variable '%s' to '%s'...\n" name $ show profileKey
- oldValueMsg = printf "\tOld value: %s\n" $ WindowsEnv.valueString oldValue
- newValueMsg = printf "\tNew value: %s\n" $ WindowsEnv.valueString newValue
+ oldValueMsg = printf "\tOld value (%s): %s\n" (valueType oldValue) (WindowsEnv.valueString oldValue)
+ newValueMsg = printf "\tNew value (%s): %s\n" (valueType newValue) (WindowsEnv.valueString newValue)
newMessage :: WindowsEnv.Profile -> WindowsEnv.Name -> WindowsEnv.Value -> String
newMessage profile name newValue =
@@ -30,7 +35,7 @@ newMessage profile name newValue =
where
profileKey = WindowsEnv.profileKeyPath profile
descrMsg = printf "Saving variable '%s' to '%s'...\n" name $ show profileKey
- newValueMsg = printf "\tNew value: %s\n" $ WindowsEnv.valueString newValue
+ newValueMsg = printf "\tNew value (%s): %s\n" (valueType newValue) (WindowsEnv.valueString newValue)
wipeMessage :: WindowsEnv.Profile -> WindowsEnv.Name -> String
wipeMessage profile name =