Added test commands for Max + modified some existing commands.

This commit is contained in:
Martin Sosic 2023-09-14 13:29:51 +02:00
parent 99c9021f82
commit 17a7e961da
4 changed files with 47 additions and 4 deletions

View File

@ -9,6 +9,7 @@ import Data.List (intercalate)
import Main.Utf8 (withUtf8)
import System.Environment (getArgs)
import System.Exit (exitFailure)
import System.IO (hFlush, hPutStr, stderr, stdout)
import Wasp.Cli.Command (runCommand)
import Wasp.Cli.Command.BashCompletion (bashCompletion, generateBashCompletionScript, printBashCompletionInstruction)
import Wasp.Cli.Command.Build (build)
@ -56,6 +57,9 @@ main = withUtf8 . (`E.catch` handleInternalErrors) $ do
["deps"] -> Command.Call.Deps
["dockerfile"] -> Command.Call.Dockerfile
["info"] -> Command.Call.Info
["max-test"] -> Command.Call.MaxTest
["max-test2"] -> Command.Call.MaxTest2
["max-test3"] -> Command.Call.MaxTest3
["completion"] -> Command.Call.PrintBashCompletionInstruction
["completion:generate"] -> Command.Call.GenerateBashCompletionScript
["completion:list"] -> Command.Call.BashCompletionListCommands
@ -84,6 +88,9 @@ main = withUtf8 . (`E.catch` handleInternalErrors) $ do
Command.Call.Compile -> runCommand compile
Command.Call.Db dbArgs -> dbCli dbArgs
Command.Call.Version -> printVersion
Command.Call.MaxTest -> doMaxTest
Command.Call.MaxTest2 -> doMaxTest2
Command.Call.MaxTest3 -> doMaxTest3
Command.Call.Uninstall -> runCommand uninstall
Command.Call.Build -> runCommand build
Command.Call.Telemetry -> runCommand Telemetry.telemetry
@ -155,6 +162,28 @@ printUsage =
]
{- ORMOLU_ENABLE -}
doMaxTest :: IO ()
doMaxTest = do
putStrLn "Max test!"
hPutStr stderr "Max test whoopsie doopsie"
waitForever
where
waitForever = threadDelay 1000000 >> waitForever
doMaxTest2 :: IO ()
doMaxTest2 = do
putStrLn "Max test!"
hPutStr stderr "Max test whoopsie doopsie"
doMaxTest3 :: IO ()
doMaxTest3 = do
putStrLn "Max test!"
hFlush stdout
hPutStr stderr "Max test whoopsie doopsie"
waitForever
where
waitForever = threadDelay 1000000 >> waitForever
printVersion :: IO ()
printVersion = do
putStrLn $
@ -170,6 +199,8 @@ printVersion = do
"Check https://github.com/wasp-lang/wasp/releases for the list of valid versions, including the latest one."
]
hPutStr stderr "Whoopsie oopsie"
-- TODO(matija): maybe extract to a separate module, e.g. DbCli.hs?
dbCli :: [String] -> IO ()
dbCli args = case args of

View File

@ -10,6 +10,9 @@ data Call
| Db Arguments -- db args
| Build
| Version
| MaxTest
| MaxTest2
| MaxTest3
| Telemetry
| Deps
| Dockerfile

View File

@ -26,7 +26,9 @@ start = do
InWaspProject waspRoot <- require
let outDir = waspRoot </> Common.dotWaspDirInWaspProjectDir </> Common.generatedCodeDirInDotWaspDir
cliSendMessageC $ Msg.Start "Starting compilation and setup phase. Hold tight..."
liftIO $ putStrLn "Is this being printed?"
cliSendMessageC $ Msg.Info "Starting compilation and setup phase. Hold tight..."
warnings <- compile

View File

@ -17,6 +17,7 @@ module Wasp.Cli.Common
where
import StrongPath (Dir, File', Path', Rel, reldir, relfile)
import System.IO (hFlush, stdout)
import Wasp.AppSpec.ExternalCode (SourceExternalCodeDir)
import qualified Wasp.Generator.Common
import Wasp.Project (WaspProjectDir)
@ -53,10 +54,16 @@ extSharedCodeDirInWaspProjectDir :: Path' (Rel WaspProjectDir) (Dir SourceExtern
extSharedCodeDirInWaspProjectDir = [reldir|src/shared|]
waspSays :: String -> IO ()
waspSays what = putStrLn $ Term.applyStyles [Term.Yellow] what
waspSays what = do
putStrLn $ Term.applyStyles [Term.Yellow] what
hFlush stdout
waspWarns :: String -> IO ()
waspWarns what = putStrLn $ Term.applyStyles [Term.Magenta] what
waspWarns what = do
putStrLn $ Term.applyStyles [Term.Magenta] what
hFlush stdout
waspScreams :: String -> IO ()
waspScreams what = putStrLn $ Term.applyStyles [Term.Red] what
waspScreams what = do
putStrLn $ Term.applyStyles [Term.Red] what
hFlush stdout