import { cosmiconfig } from 'cosmiconfig' ; import logdown from 'logdown' ; import { CopyConfig , CopyConfigOptions } from './' ; const configExplorer = cosmiconfig ( 'copyconfig' ) ; const logger = logdown ( '@wireapp/copy-config/cli' , { markdown : false , } ) ; logger . state . isEnabled = true ; ( async ( ) => { const configFile = await configExplorer . search ( ) ; if ( configFile ) { logger . info ( `Found configuration file "${ configFile . filepath }".` ) ; } const config = configFile ? configFile . config : undefined ; const copiedFiles = await new CopyConfig ( config ) . copy ( ) ; const copyMessage = copiedFiles . length ? `Copied ${ copiedFiles . length }` : "Didn't copy any" ; logger . info ( `${ copyMessage } file${ copiedFiles . length === 1 ? '' : 's' }.` ) ; } ) ( ) . catch ( error => { console . error ( error ) ; process . exit ( 1 ) ; } ) ;