Skip to content

Commit

Permalink
chore: rename 'registerCommand' to 'extendCli'
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz committed Dec 8, 2018
1 parent 379ca9b commit 1f7bf85
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/@vuepress/core/lib/plugin-api/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const PLUGIN_OPTION_META_MAP = {
GLOBAL_UI_COMPONENTS: { name: 'globalUIComponents', types: [String, Array] },
DEFINE: { name: 'define', types: [Function, Object] },
ALIAS: { name: 'alias', types: [Function, Object] },
REGISTER_COMMAND: { name: 'registerCommand', types: [Function] }
EXTEND_CLI: { name: 'extendCli', types: [Function] }
}

const PLUGIN_OPTION_MAP = {}
Expand Down
4 changes: 2 additions & 2 deletions packages/@vuepress/core/lib/plugin-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ module.exports = class PluginAPI {
globalUIComponents,
define,
alias,
registerCommand
extendCli
}) {
const isInternalPlugin = pluginName.startsWith('@vuepress/internal-')
logger[isInternalPlugin ? 'debug' : 'tip'](pluginLog(pluginName, shortcut))
Expand All @@ -230,7 +230,7 @@ module.exports = class PluginAPI {
.registerOption(PLUGIN_OPTION_MAP.GLOBAL_UI_COMPONENTS.key, globalUIComponents, pluginName)
.registerOption(PLUGIN_OPTION_MAP.DEFINE.key, define, pluginName)
.registerOption(PLUGIN_OPTION_MAP.ALIAS.key, alias, pluginName)
.registerOption(PLUGIN_OPTION_MAP.REGISTER_COMMAND.key, registerCommand, pluginName)
.registerOption(PLUGIN_OPTION_MAP.EXTEND_CLI.key, extendCli, pluginName)
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/vuepress/lib/handleUnknownCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = async function (cli, options) {

if (sourceDir) {
context = await prepare(sourceDir, options)
context.pluginAPI.options.registerCommand.apply(cli)
context.pluginAPI.options.extendCli.apply(cli)
}

logger.setOptions({ logLevel: 3 })
Expand Down Expand Up @@ -107,7 +107,7 @@ function registerUnknownCommands (cli, options) {
...options,
...commandoptions
}, false /* isProd */)
await context.pluginAPI.options.registerCommand.apply(subCli)
await context.pluginAPI.options.extendCli.apply(subCli)
},
async afterParse (subCli) {
if (!subCli.matchedCommand) {
Expand Down

0 comments on commit 1f7bf85

Please sign in to comment.