From 1ab0697d268c27a0d7871e0f6bcb6ba1a165fb77 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 13 Dec 2016 03:20:58 +0300 Subject: setenv: prompt message update It also now uncoditionally overrides variables (i.e. even when the corresponding registy values are not strings). --- apps/PromptMessage.hs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'apps/PromptMessage.hs') diff --git a/apps/PromptMessage.hs b/apps/PromptMessage.hs index 27851cf..2bee0a5 100644 --- a/apps/PromptMessage.hs +++ b/apps/PromptMessage.hs @@ -5,7 +5,8 @@ -- Stability : experimental module PromptMessage - ( engraveMessage + ( oldNewMessage + , newMessage , wipeMessage ) where @@ -13,17 +14,23 @@ import Text.Printf (printf) import qualified Windows.Environment as Env -engraveMessage :: Env.Profile -> Env.VarName -> Env.VarValue -> Env.VarValue -> String -engraveMessage profile name oldValue newValue = - descriptionMsg ++ oldValueMsg ++ newValueMsg +oldNewMessage :: Env.Profile -> Env.VarName -> Env.VarValue -> Env.VarValue -> String +oldNewMessage profile name oldValue newValue = + descrMsg ++ oldValueMsg ++ newValueMsg where profileKey = Env.profileKeyPath profile - - descriptionMsg = printf "Saving variable '%s' to '%s'...\n" name (show profileKey) - + descrMsg = printf "Saving variable '%s' to '%s'...\n" name (show profileKey) oldValueMsg = printf "\tOld value: %s\n" oldValue newValueMsg = printf "\tNew value: %s\n" newValue +newMessage :: Env.Profile -> Env.VarName -> Env.VarValue -> String +newMessage profile name newValue = + descrMsg ++ newValueMsg + where + profileKey = Env.profileKeyPath profile + descrMsg = printf "Saving variable '%s' to '%s'...\n" name (show profileKey) + newValueMsg = printf "\tNew value: %s\n" newValue + wipeMessage :: Env.Profile -> Env.VarName -> String wipeMessage profile name = printf "Deleting variable '%s' from '%s'...\n" name (show profileKey) -- cgit v1.2.3