mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-16 21:58:39 -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 = () => {
|
const checkConfig = () => {
|
||||||
if (api.exists()) {
|
if (api.exists()) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -42,21 +35,21 @@ const checkConfig = () => {
|
||||||
|
|
||||||
args.command(['i', 'install'], 'Install a plugin', (name, args_) => {
|
args.command(['i', 'install'], 'Install a plugin', (name, args_) => {
|
||||||
checkConfig();
|
checkConfig();
|
||||||
assertPluginName(args_[0]);
|
const pluginName = args_[0];
|
||||||
const plugin = getPluginName(args_[0]);
|
assertPluginName(pluginName);
|
||||||
commandPromise = api
|
commandPromise = api
|
||||||
.install(plugin)
|
.install(pluginName)
|
||||||
.then(() => console.log(chalk.green(`${plugin} installed successfully!`)))
|
.then(() => console.log(chalk.green(`${pluginName} installed successfully!`)))
|
||||||
.catch(err => console.error(chalk.red(err)));
|
.catch(err => console.error(chalk.red(err)));
|
||||||
});
|
});
|
||||||
|
|
||||||
args.command(['u', 'uninstall', 'rm', 'remove'], 'Uninstall a plugin', (name, args_) => {
|
args.command(['u', 'uninstall', 'rm', 'remove'], 'Uninstall a plugin', (name, args_) => {
|
||||||
checkConfig();
|
checkConfig();
|
||||||
assertPluginName(args_[0]);
|
const pluginName = args_[0];
|
||||||
const plugin = getPluginName(args_[0]);
|
assertPluginName(pluginName);
|
||||||
commandPromise = api
|
commandPromise = api
|
||||||
.uninstall(plugin)
|
.uninstall(pluginName)
|
||||||
.then(() => console.log(chalk.green(`${plugin} uninstalled successfully!`)))
|
.then(() => console.log(chalk.green(`${pluginName} uninstalled successfully!`)))
|
||||||
.catch(err => console.log(chalk.red(err)));
|
.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_) => {
|
args.command(['d', 'docs', 'h', 'home'], 'Open the npm page of a plugin', (name, args_) => {
|
||||||
assertPluginName(args_[0]);
|
const pluginName = args_[0];
|
||||||
const plugin = getPluginName(args_[0]);
|
assertPluginName(pluginName);
|
||||||
opn(`http://ghub.io/${plugin}`, {wait: false});
|
opn(`http://ghub.io/${pluginName}`, {wait: false});
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue