Console

  • 2018-12-03

The console forms the bridge between Hexo and its users. It registers and describes the available console commands.

Synopsis

1
2
3
hexo.extend.console.register(name, desc, options, function(args){
// ...
});
Argument Description
name Name
desc Description
options Options

An argument args will be passed into the function. This is the argument that users type into the terminal. It’s parsed by Minimist.

Options

usage

The usage of a console command. For example:

1
2
{usage: '[layout] <title>'}
// hexo new [layout] <title>

arguments

The description of each argument of a console command. For example:

1
2
3
4
5
6
{
arguments: [
{name: 'layout', desc: 'Post layout'},
{name: 'title', desc: 'Post title'}
]
}

options

The description of each option of a console command. For example:

1
2
3
4
5
{
options: [
{name: '-r, --replace', desc: 'Replace existing files'}
]
}

desc

More detailed information about a console command.

Example

1
2
3
hexo.extend.console.register('config', 'Display configuration', function(args){
console.log(hexo.config);
});

扫码领红包

2018双11超级红包
PC访问链接: 2018双11超级红包 预售开启 汇聚全球潮流新品

淘口令:¥20Y0b6q4eHR¥ (复制此行再打开手机淘宝客访问)

最后更新: 2018年12月03日 09:29

原始链接: https://cyc.oy99.com/api/console.html

× 多少都行~
打赏二维码
×
  • {title}