updates user prompt message for "set" uninstalled version in BrickMain

This commit is contained in:
Arjun Kathuria 2022-06-28 19:49:00 +05:30
parent b8dac2d7cd
commit 3bbc1edb19

View File

@ -53,6 +53,8 @@ import Text.PrettyPrint.HughesPJClass ( prettyShow )
import URI.ByteString import URI.ByteString
import qualified Data.Text as T import qualified Data.Text as T
import qualified Data.Text.Lazy.Builder as B
import qualified Data.Text.Lazy as L
import qualified Graphics.Vty as Vty import qualified Graphics.Vty as Vty
import qualified Data.Vector as V import qualified Data.Vector as V
import System.Environment (getExecutablePath) import System.Environment (getExecutablePath)
@ -510,13 +512,18 @@ set' bs input@(_, ListResult {..}) = do
>>= \case >>= \case
VRight _ -> pure $ Right () VRight _ -> pure $ Right ()
VLeft e -> case e of VLeft e -> case e of
(V (NotInstalled tool tver)) -> do (V (NotInstalled tool _)) -> do
promptAnswer <- liftIO $ getUserPromptResponse userPrompt promptAnswer <- getUserPromptResponse userPrompt
case promptAnswer of case promptAnswer of
PromptYes -> install' bs input PromptYes -> install' bs input
PromptNo -> pure $ Left (prettyShow e) PromptNo -> pure $ Left (prettyShow e)
where where
userPrompt = "The tool/version you're trying to set is not installed, would you like to install it first? " userPrompt = L.toStrict $
B.toLazyText $
B.fromString " This Version of " <>
B.fromString (show tool) <>
B.fromString " you are trying to set is not installed.\n" <>
B.fromString " Would you like to install it first? [Y/N]: "
_ -> pure $ Left (prettyShow e) _ -> pure $ Left (prettyShow e)