mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Remove auto prefix plugin name (#2757)
* Remove auto prefix plugin name * Remove unused function * Cleanup
This commit is contained in:
parent
e4cef0a172
commit
943211bd09
1 changed files with 11 additions and 18 deletions
29
cli/index.js
29
cli/index.js
|
|
@ -23,13 +23,6 @@ const assertPluginName = pluginName => {
|
|||
}
|
||||
};
|
||||
|
||||
const getPluginName = arg => {
|
||||
if (arg.indexOf(PLUGIN_PREFIX) !== 0) {
|
||||
return `${PLUGIN_PREFIX}${arg}`;
|
||||
}
|
||||
return arg;
|
||||
};
|
||||
|
||||
const checkConfig = () => {
|
||||
if (api.exists()) {
|
||||
return true;
|
||||
|
|
@ -42,21 +35,21 @@ const checkConfig = () => {
|
|||
|
||||
args.command(['i', 'install'], 'Install a plugin', (name, args_) => {
|
||||
checkConfig();
|
||||
assertPluginName(args_[0]);
|
||||
const plugin = getPluginName(args_[0]);
|
||||
const pluginName = args_[0];
|
||||
assertPluginName(pluginName);
|
||||
commandPromise = api
|
||||
.install(plugin)
|
||||
.then(() => console.log(chalk.green(`${plugin} installed successfully!`)))
|
||||
.install(pluginName)
|
||||
.then(() => console.log(chalk.green(`${pluginName} installed successfully!`)))
|
||||
.catch(err => console.error(chalk.red(err)));
|
||||
});
|
||||
|
||||
args.command(['u', 'uninstall', 'rm', 'remove'], 'Uninstall a plugin', (name, args_) => {
|
||||
checkConfig();
|
||||
assertPluginName(args_[0]);
|
||||
const plugin = getPluginName(args_[0]);
|
||||
const pluginName = args_[0];
|
||||
assertPluginName(pluginName);
|
||||
commandPromise = api
|
||||
.uninstall(plugin)
|
||||
.then(() => console.log(chalk.green(`${plugin} uninstalled successfully!`)))
|
||||
.uninstall(pluginName)
|
||||
.then(() => console.log(chalk.green(`${pluginName} uninstalled successfully!`)))
|
||||
.catch(err => console.log(chalk.red(err)));
|
||||
});
|
||||
|
||||
|
|
@ -134,9 +127,9 @@ args.command(['lsr', 'list-remote', 'ls-remote'], 'List plugins available on npm
|
|||
});
|
||||
|
||||
args.command(['d', 'docs', 'h', 'home'], 'Open the npm page of a plugin', (name, args_) => {
|
||||
assertPluginName(args_[0]);
|
||||
const plugin = getPluginName(args_[0]);
|
||||
opn(`http://ghub.io/${plugin}`, {wait: false});
|
||||
const pluginName = args_[0];
|
||||
assertPluginName(pluginName);
|
||||
opn(`http://ghub.io/${pluginName}`, {wait: false});
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue