diff options
Diffstat (limited to '')
-rw-r--r-- | apps/PromptMessage.hs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/apps/PromptMessage.hs b/apps/PromptMessage.hs index 226a090..5ed7c4b 100644 --- a/apps/PromptMessage.hs +++ b/apps/PromptMessage.hs @@ -9,25 +9,26 @@ module PromptMessage , wipeMessage ) where -import Data.Maybe (fromJust, isJust) +import Data.Maybe (isJust) import Text.Printf (printf) import qualified Windows.Environment as Env engraveMessage :: Env.Profile -> Env.VarName -> Maybe Env.VarValue -> Env.VarValue -> String engraveMessage profile name oldValue newValue = - warning ++ values + descriptionMsg ++ oldValueMsg ++ newValueMsg where - warning = printf "Saving variable '%s' to '%s'...\n" name $ Env.profileKeyPath profile + profileKey = Env.profileKeyPath profile - values - | isJust oldValue = oldValueMsg ++ newValueMsg - | otherwise = valueMsg + descriptionMsg = printf "Saving variable '%s' to '%s'...\n" name profileKey - oldValueMsg = printf "\tOld value: %s\n" $ fromJust oldValue - newValueMsg = printf "\tNew value: %s\n" newValue - valueMsg = printf "\tValue: %s\n" newValue + oldValueMsg = maybe "" (printf "\tOld value: %s\n") oldValue + newValueMsg + | isJust oldValue = printf "\tNew value: %s\n" newValue + | otherwise = printf "\tValue: %s\n" newValue wipeMessage :: Env.Profile -> Env.VarName -> String wipeMessage profile name = - printf "Deleting variable '%s' from '%s'...\n" name $ Env.profileKeyPath profile + printf "Deleting variable '%s' from '%s'...\n" name profileKey + where + profileKey = Env.profileKeyPath profile |