Skip to content

Commit

Permalink
rename console
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Nov 2, 2022
1 parent 3a3cad0 commit 9b351d3
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions lib/plugins/console/index.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
'use strict';

const cleanConsole = require('./clean');
const configConsole = require('./config');
const deployConsole = require('./deploy');
const generateConsole = require('./generate');
const listConsole = require('./list');
const migrateConsole = require('./migrate');
const newConsole = require('./new');
const publishConsole = require('./publish');
const renderConsole = require('./render');

module.exports = function(ctx) {
const { console } = ctx.extend;

console.register('clean', 'Remove generated files and cache.', require('./clean'));
console.register('clean', 'Remove generated files and cache.', cleanConsole);

console.register('config', 'Get or set configurations.', {
usage: '[name] [value]',
arguments: [
{name: 'name', desc: 'Setting name. Leave it blank if you want to show all configurations.'},
{name: 'value', desc: 'New value of a setting. Leave it blank if you just want to show a single configuration.'}
]
}, require('./config'));
}, configConsole);

console.register('deploy', 'Deploy your website.', {
options: [
{name: '--setup', desc: 'Setup without deployment'},
{name: '-g, --generate', desc: 'Generate before deployment'}
]
}, require('./deploy'));
}, deployConsole);

console.register('generate', 'Generate static files.', {
options: [
Expand All @@ -28,23 +38,23 @@ module.exports = function(ctx) {
{name: '-b, --bail', desc: 'Raise an error if any unhandled exception is thrown during generation'},
{name: '-c, --concurrency', desc: 'Maximum number of files to be generated in parallel. Default is infinity'}
]
}, require('./generate'));
}, generateConsole);

console.register('list', 'List the information of the site', {
desc: 'List the information of the site.',
usage: '<type>',
arguments: [
{name: 'type', desc: 'Available types: page, post, route, tag, category'}
]
}, require('./list'));
}, listConsole);

console.register('migrate', 'Migrate your site from other system to Hexo.', {
init: true,
usage: '<type>',
arguments: [
{name: 'type', desc: 'Migrator type.'}
]
}, require('./migrate'));
}, migrateConsole);

console.register('new', 'Create a new post.', {
usage: '[layout] <title>',
Expand All @@ -57,15 +67,15 @@ module.exports = function(ctx) {
{name: '-s, --slug', desc: 'Post slug. Customize the URL of the post.'},
{name: '-p, --path', desc: 'Post path. Customize the path of the post.'}
]
}, require('./new'));
}, newConsole);

console.register('publish', 'Moves a draft post from _drafts to _posts folder.', {
usage: '[layout] <filename>',
arguments: [
{name: 'layout', desc: 'Post layout. Use post, page, draft or whatever you want.'},
{name: 'filename', desc: 'Draft filename. "hello-world" for example.'}
]
}, require('./publish'));
}, publishConsole);

console.register('render', 'Render files with renderer plugins.', {
init: true,
Expand All @@ -76,5 +86,5 @@ module.exports = function(ctx) {
{name: '--engine', desc: 'Specify render engine'},
{name: '--pretty', desc: 'Prettify JSON output'}
]
}, require('./render'));
}, renderConsole);
};

0 comments on commit 9b351d3

Please sign in to comment.