mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
27 lines
572 B
JavaScript
27 lines
572 B
JavaScript
import simpleImport from './simple-import.js';
|
|
import tryToCatch from 'try-catch';
|
|
|
|
const noop = (req, res, next) => {
|
|
next && next();
|
|
};
|
|
|
|
noop.listen = noop;
|
|
|
|
export default async (config, arg) => {
|
|
if (!config('terminal'))
|
|
return noop;
|
|
|
|
const [e, terminalModule] = await tryToCatch(simpleImport, config('terminalPath'));
|
|
|
|
if (!e && !arg)
|
|
return terminalModule;
|
|
|
|
if (!e)
|
|
return terminalModule(arg);
|
|
|
|
config('terminal', false);
|
|
console.log(`cloudcmd --terminal: ${e.message}`);
|
|
|
|
return noop;
|
|
};
|
|
|