mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 07:21:43 +00:00
32 lines
770 B
JavaScript
32 lines
770 B
JavaScript
// shoutcut.js
|
|
// Namhyeon Go <abuse@catswords.net>
|
|
// https://github.com/gnh1201/welsonjs
|
|
var SHELL = require("lib/shell");
|
|
var SYS = require("lib/system");
|
|
|
|
function main(args) {
|
|
if (args.length < 1) {
|
|
console.error("arguments could not be empty")
|
|
return;
|
|
}
|
|
|
|
var FN = args[0];
|
|
var target = require(FN);
|
|
|
|
if ("onShoutcut" in target) {
|
|
console.log("Trying execute onShoutcut:", FN);
|
|
while (true) {
|
|
try {
|
|
target.onShoutcut(args.slice(1));
|
|
} catch (e) {
|
|
console.error("onShoutcut ->", e.message);
|
|
target.onShoutcut(args.slice(1));
|
|
}
|
|
}
|
|
} else {
|
|
console.error("onShoutcut not defined");
|
|
}
|
|
};
|
|
|
|
exports.main = main;
|