All files / rusted-chromium rusted.ts

82.6% Statements 19/23
71.42% Branches 5/7
100% Functions 1/1
82.6% Lines 19/23

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 323x 3x   3x 3x 3x 3x 3x   3x 13x   13x           13x 2x 2x 11x 10x 10x 1x 1x 1x          
import { readConfig } from './config/config'
import { downloadChromium } from './download/download'
import type { IChromeConfig, IStoreConfig, IExportConfig } from './interfaces/interfaces'
import { logger } from './log/logger'
import { progress } from './log/progress'
import { spinner } from './log/spinner'
import { exportStore } from './store/exportStore'
import { importAndMergeLocalstore } from './store/importStore'
 
export async function rusted(args: string[], platform: NodeJS.Platform): Promise<void> {
    const configWrapper = readConfig(args, platform)
 
    Iif (configWrapper.config.quiet) {
        spinner.silent()
        logger.silent()
        progress.silent()
    }
 
    if (configWrapper.action === 'importStore') {
        const config: IStoreConfig = configWrapper.config
        await importAndMergeLocalstore(config)
    } else if (configWrapper.action === 'loadChrome') {
        const config: IChromeConfig = configWrapper.config
        await downloadChromium(config)
    } else if (configWrapper.action === 'exportStore') {
        const config: IExportConfig = configWrapper.config
        exportStore(config, process.stdout)
    } else E{
        logger.error(`Failed to read config: ${JSON.stringify(configWrapper)}`)
    }
}