<commit_before>
module Main where

import Data.Maybe
import System.Environment

import qualified Examples.Tar.Main as Tar
import qualified Examples.Self.Main as Self
import qualified Examples.Test.Basic1 as Basic1
import qualified Examples.Test.Directory as Directory
import qualified Examples.Test.Errors as Errors
import qualified Examples.Test.Files as Files
import qualified Examples.Test.FilePath as FilePath
import qualified Examples.Test.Pool as Pool


fakes = ["clean" * clean, "test" * test]
    where (*) = (,)

mains = ["tar" * Tar.main, "self" * Self.main
        ,"basic1" * Basic1.main, "directory" * Directory.main, "errors" * Errors.main
        ,"filepath" * FilePath.main, "files" * Files.main, "pool" * Pool.main]
    where (*) = (,)


main :: IO ()
main = do
    xs <- getArgs
    case flip lookup (fakes ++ mains) =<< listToMaybe xs of
        Nothing -> error $ "Enter one of the examples: " ++ unwords (map fst $ fakes ++ mains)
        Just main -> main


clean :: IO ()
clean = sequence_ [withArgs [name,"clean"] main | (name,main) <- mains]


test :: IO ()
test = sequence_ [withArgs [name,"test"] main | (name,main) <- mains]<commit_msg>Add a better message when typing nothing<commit_after>
module Main where

import Data.Maybe
import System.Environment

import Examples.Util(flags)
import qualified Examples.Tar.Main as Tar
import qualified Examples.Self.Main as Self
import qualified Examples.Test.Basic1 as Basic1
import qualified Examples.Test.Directory as Directory
import qualified Examples.Test.Errors as Errors
import qualified Examples.Test.Files as Files
import qualified Examples.Test.FilePath as FilePath
import qualified Examples.Test.Pool as Pool


fakes = ["clean" * clean, "test" * test]
    where (*) = (,)

mains = ["tar" * Tar.main, "self" * Self.main
        ,"basic1" * Basic1.main, "directory" * Directory.main, "errors" * Errors.main
        ,"filepath" * FilePath.main, "files" * Files.main, "pool" * Pool.main]
    where (*) = (,)


main :: IO ()
main = do
    xs <- getArgs
    case flip lookup (fakes ++ mains) =<< listToMaybe xs of
        Nothing -> putStrLn $ unlines
            ["Welcome to the Shake demo"
            ,""
            ,unwords $ "Modes:" : map fst fakes
            ,unwords $ "Demos:" : map fst mains
            ,unwords $ "Flags:" : flags]
        Just main -> main


clean :: IO ()
clean = sequence_ [withArgs [name,"clean"] main | (name,main) <- mains]


test :: IO ()
test = sequence_ [withArgs [name,"test"] main | (name,main) <- mains]
{'fraction_non_alphanumeric': 0.12777777777777777, 'fraction_numerical': 0.0031746031746031746, 'mean_word_length': 3.3465517241379312, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2151216', 'n_tokens_mistral': 776, 'n_tokens_neox': 740, 'n_words': 254}