<commit_before>module Main where

import Data.Monoid ((<>))
import Network.Google.Api
import Network.Google.OAuth2
import System.Environment.XDG.BaseDir (getUserCacheDir)
import System.FilePath ((</>), (<.>))
import System.Exit (exitFailure)
import System.IO (hPutStrLn, stderr)

import qualified Data.Text as T

import Drync.Client
import Drync.Options
import Drync.Sync

main :: IO ()
main = do
    options <- getOptions

    file <- tokenFile $ oProfile options
    token <- getAccessToken client scopes (oRefresh options) file

    let syncFrom = oSyncFrom options
        syncTo = T.pack $ oSyncTo options
        apiOptions = def
            { apiUploadType =
                if oMultipart options
                    then Multipart
                    else Resumable
            , apiThrottle =
                if oThrottle options /= 0
                    then Just $ oThrottle options * 1000
                    else Nothing
            , apiProgress = Just $ oProgress options
            , apiDebug = oDebug options
            }

    result <- runApi token apiOptions $ sync syncFrom syncTo

    case result of
        Left ex -> do
            hPutStrLn stderr $ "API Error: " <> show ex
            exitFailure<commit_msg>Treat --progress 0 as disabling<commit_after>module Main where

import Data.Monoid ((<>))
import Network.Google.Api
import Network.Google.OAuth2
import System.Environment.XDG.BaseDir (getUserCacheDir)
import System.FilePath ((</>), (<.>))
import System.Exit (exitFailure)
import System.IO (hPutStrLn, stderr)

import qualified Data.Text as T

import Drync.Client
import Drync.Options
import Drync.Sync

main :: IO ()
main = do
    options <- getOptions

    file <- tokenFile $ oProfile options
    token <- getAccessToken client scopes (oRefresh options) file

    let syncFrom = oSyncFrom options
        syncTo = T.pack $ oSyncTo options
        apiOptions = def
            { apiUploadType =
                if oMultipart options
                    then Multipart
                    else Resumable
            , apiThrottle =
                if oThrottle options /= 0
                    then Just $ oThrottle options * 1000
                    else Nothing
            , apiProgress =
                if oProgress options /= 0
                    then Just $ oProgress options
                    else Nothing
            , apiDebug = oDebug options
            }

    result <- runApi token apiOptions $ sync syncFrom syncTo

    case result of
        Left ex -> do
            hPutStrLn stderr $ "API Error: " <> show ex
            exitFailure
{'fraction_non_alphanumeric': 0.0694980694980695, 'fraction_numerical': 0.005405405405405406, 'mean_word_length': 1.8788888888888888, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 13, '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': '1381366', 'n_tokens_mistral': 715, 'n_tokens_neox': 669, 'n_words': 222}