Skip to content

Commit

Permalink
show errors and contexts again
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorTaelin committed Sep 29, 2024
1 parent cd3cb56 commit 38b0a7f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Kind/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,17 @@ apiCheckFile book defs path = do
Just names -> [(name, term) | name <- names, Just term <- [M.lookup name book]]
Nothing -> []
results <- forM termsToCheck $ \(name, term) -> do
putStrLn $ "Checking " ++ name ++ ":"
case envRun (doCheck term) book of
Done state _ -> do
Done state value -> do
apiPrintLogs state
putStrLn $ "\x1b[32m✓ " ++ name ++ "\x1b[0m"
return $ Right ()
Fail _ -> do
Fail state -> do
apiPrintLogs state
putStrLn $ "\x1b[31m✗ " ++ name ++ "\x1b[0m"
return $ Left $ "Error."
putStrLn ""
return $ sequence_ results

apiCheckAll :: FilePath -> IO (Either String ())
Expand Down Expand Up @@ -272,7 +276,7 @@ runRDeps basePath input = do
printHelp :: IO (Either String ())
printHelp = do
putStrLn "Kind usage:"
putStrLn " kind check # Checks all .kind files in the current directory and subdirectories"
putStrLn " kind check # Checks all .kind files in the current directory and subdirectories"
putStrLn " kind check <name|path> # Type-checks all definitions in the specified file"
putStrLn " kind run <name|path> # Normalizes the specified definition"
putStrLn " kind show <name|path> # Stringifies the specified definition"
Expand All @@ -281,3 +285,4 @@ printHelp = do
putStrLn " kind rdeps <name|path> # Shows all dependencies of the specified definition recursively"
putStrLn " kind help # Shows this help message"
return $ Right ()

0 comments on commit 38b0a7f

Please sign in to comment.