terminalizer/commands/config.js

54 lines
1.0 KiB
JavaScript
Raw Normal View History

2018-07-22 22:34:35 +00:00
/**
* Config
* Generate a config file in the current directory
*
* @author Mohammad Fares <faressoft.com@gmail.com>
*/
/**
* Executed after the command completes its task
*/
function done() {
console.log(di.chalk.green('Successfully Saved'));
console.log('The config file is saved into the file:');
console.log(di.chalk.magenta('config.yml'));
// Terminate the app
process.exit();
}
/**
* The command's main function
*
* @param {Object} argv
*/
function command(argv) {
di.fs.copy(di.path.join(ROOT_PATH, 'config.yml'), 'config.yml', done);
}
////////////////////////////////////////////////////
// Command Definition //////////////////////////////
////////////////////////////////////////////////////
/**
* Command's usage
* @type {String}
*/
module.exports.command = 'config';
/**
* Command's description
* @type {String}
*/
module.exports.describe = 'Generate a config file in the current directory';
/**
* Command's handler function
* @type {Function}
*/
module.exports.handler = command;