You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
958 B

import chalk from 'chalk'
import { resolveEnabledConfig } from './helpers/resolver.ts'
import Docket from './docket.ts'
import logger from './helpers/logger.ts'
import run from './_run.ts'
/**
* Run single Config that is in Directory /resources/configs/enabled
*
* @author Björn Hase <me@herr-hase.wtf>
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://git.node001.net/HerrHase/super-hog.git
*
*/
const args = process.argv.slice(2)
if (args[0] === undefined) {
console.log(chalk.red('Required name for config'))
process.exit(0)
}
// get all configs from resolveEnabledConfig
const configs = resolveEnabledConfig(args[0])
// check if there is any valid config
if (configs.length === 0) {
console.log(chalk.red('Config ' + args[0] + ' not found!'))
process.exit(0)
}
const config = configs[0]
try {
const docket = await run(config)
} catch(error) {
logger(config.slug).error(error)
}