30 lines
676 B
JavaScript
30 lines
676 B
JavaScript
|
const { program } = require('commander'); // 命令行提示工具
|
||
|
const figlet = require('figlet'); // 生成艺术字
|
||
|
|
||
|
module.exports = {
|
||
|
/**
|
||
|
* 给help信息添加提示
|
||
|
*/
|
||
|
CommandLogHelp() {
|
||
|
program.on('--help', function () {
|
||
|
console.log(
|
||
|
// 设置帮助信息下打印艺术字
|
||
|
figlet.textSync('Bunny-Cli', {
|
||
|
font: 'Ghost',
|
||
|
horizontalLayout: 'default',
|
||
|
verticalLayout: 'default',
|
||
|
width: 100,
|
||
|
whitespaceBreak: true,
|
||
|
}),
|
||
|
);
|
||
|
});
|
||
|
},
|
||
|
/**
|
||
|
* 给出version版本号
|
||
|
*/
|
||
|
CommandLogStart() {
|
||
|
program.name('bunny-cli').usage('<command> [options]');
|
||
|
program.version(`😉 v${require('../package.json').version}`);
|
||
|
},
|
||
|
};
|