first commit
This commit is contained in:
53
commands/config.js
Normal file
53
commands/config.js
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* 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;
|
||||
Reference in New Issue
Block a user