semo-plugin-shell
Version:
A semo plugin to provide a quick shell.
34 lines • 1.03 kB
JavaScript
import { error } from '@semo/core';
import { openRepl } from '../common/utils.js';
export const plugin = 'shell';
export const command = 'shell';
export const desc = 'Quick shell';
export const aliases = 'sh';
export const builder = function (yargs) {
yargs.option('prompt', {
describe: 'Prompt for input.',
default: '$ ',
});
yargs.option('prefix', {
describe: 'Make input command a little bit faster.',
});
yargs.option('debug', {
describe: 'Debug mode, show error stack',
});
};
export const handler = async function (argv) {
const scriptName = argv.scriptName || 'semo';
argv.prefix = argv.$core.getPluginConfig('prefix', scriptName);
argv.prompt = argv.$core.getPluginConfig('prompt', '$ ');
argv.debug = argv.$core.getPluginConfig('debug', false);
try {
const context = { argv };
await openRepl(context);
return false;
}
catch (e) {
error(e.stack);
}
return true;
};
//# sourceMappingURL=shell.js.map