<commit_before>
{-# LANGUAGE ScopedTypeVariables, FlexibleContexts #-}

module CmdLineOptDefinitions where -- Export everything

import System.Console.GetOpt
import System.Environment
import Control.Monad.IO.Class
import Control.Monad.Error

-- Command line flag / option parsing, defaults

data Flag = FlagOAuthFile String
          | FlagHelp
          | FlagLogNetwork
          | FlagReplayLog
          | FlagLogFolder String
          | FlagImageCacheFolder String
          | FlagConcImgFetches String
          | FlagVerifyImgCache
          | FlagTraceFile String
          | FlagTraceLevel String
          | FlagTraceEchoOn
          | FlagTraceAppend
          | FlagConKeepAlive String
          | FlagConTimeout String
          | FlagTweetHistory String
          | FlagImgMemCacheSize String
          | FlagStatTraceInterval String
          | FlagFirehose
          | FlagTraceDisableColor
            deriving (Eq, Show)

defLogFolder, defImageCacheFolder, defTraceFn :: String
defLogFolder = "./log/"
defImageCacheFolder = "http_img_cache"
defTraceFn = "./trace.log"
defConcImgFetches :: Int
defConcImgFetches = 50
defConKeepAlive :: Int
defConKeepAlive = 10
defConTimeout :: Int
defConTimeout = 5 * 1000 * 1000
defTweetHistory :: Int
defTweetHistory = 1024
defImgMemCacheSize :: Int
defImgMemCacheSize = 1024
defStatTraceInterval = 10.0
defStatTraceInterval :: Double

parseCmdLineOpt :: (MonadError String m, MonadIO m) => m [Flag]
parseCmdLineOpt = do
    name <- liftIO $ getProgName
    args <- liftIO $ getArgs<commit_msg>Reduced default number of concurrent image fetches to 20<commit_after>
{-# LANGUAGE ScopedTypeVariables, FlexibleContexts #-}

module CmdLineOptDefinitions where -- Export everything

import System.Console.GetOpt
import System.Environment
import Control.Monad.IO.Class
import Control.Monad.Error

-- Command line flag / option parsing, defaults

data Flag = FlagOAuthFile String
          | FlagHelp
          | FlagLogNetwork
          | FlagReplayLog
          | FlagLogFolder String
          | FlagImageCacheFolder String
          | FlagConcImgFetches String
          | FlagVerifyImgCache
          | FlagTraceFile String
          | FlagTraceLevel String
          | FlagTraceEchoOn
          | FlagTraceAppend
          | FlagConKeepAlive String
          | FlagConTimeout String
          | FlagTweetHistory String
          | FlagImgMemCacheSize String
          | FlagStatTraceInterval String
          | FlagFirehose
          | FlagTraceDisableColor
            deriving (Eq, Show)

defLogFolder, defImageCacheFolder, defTraceFn :: String
defLogFolder = "./log/"
defImageCacheFolder = "http_img_cache"
defTraceFn = "./trace.log"
defConcImgFetches :: Int
defConcImgFetches = 20
defConKeepAlive :: Int
defConKeepAlive = 10
defConTimeout :: Int
defConTimeout = 5 * 1000 * 1000
defTweetHistory :: Int
defTweetHistory = 1024
defImgMemCacheSize :: Int
defImgMemCacheSize = 1024
defStatTraceInterval = 10.0
defStatTraceInterval :: Double

parseCmdLineOpt :: (MonadError String m, MonadIO m) => m [Flag]
parseCmdLineOpt = do
    name <- liftIO $ getProgName
    args <- liftIO $ getArgs
{'fraction_non_alphanumeric': 0.06498884995221409, 'fraction_numerical': 0.01592863969417012, 'mean_word_length': 3.0, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '1334980', 'n_tokens_mistral': 934, 'n_tokens_neox': 874, 'n_words': 227}