mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 07:32:54 +00:00
Remove unused code and assets
Remove unused code, assets, and stale config entries.
This commit is contained in:
54 files changed
+5
-1044
No files matched your search
@@ -1,32 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
const STEP_MATCHERS = [
|
||||
{ regex: /await\s+nct\.screen\.waitForPrompt\s*\(/g, label: "waitForPrompt" },
|
||||
{ regex: /await\s+nct\.screen\.waitForAny\s*\(/g, label: "waitForAny" },
|
||||
{ regex: /await\s+nct\.screen\.waitForText\s*\(/g, label: "waitForText" },
|
||||
{ regex: /await\s+nct\.screen\.waitForRegex\s*\(/g, label: "waitForRegex" },
|
||||
{ regex: /await\s+nct\.screen\.waitFor\s*\(/g, label: "waitFor" },
|
||||
{ regex: /await\s+nct\.screen\.sendLine\s*\(/g, label: "sendLine" },
|
||||
{ regex: /await\s+nct\.screen\.send\s*\(/g, label: "send" },
|
||||
{ regex: /await\s+nct\.screen\.clear\s*\(/g, label: "clear" },
|
||||
{ regex: /await\s+nct\.session\.sleep\s*\(/g, label: "sleep" },
|
||||
{ regex: /await\s+nct\.sleep\s*\(/g, label: "sleep" },
|
||||
{ regex: /await\s+nct\.session\.disconnect\s*\(/g, label: "disconnect" },
|
||||
{ regex: /await\s+nct\.session\.startLog\s*\(/g, label: "startLog" },
|
||||
{ regex: /nct\.log\s*\(/g, label: "log" },
|
||||
];
|
||||
|
||||
function countScriptSteps(source) {
|
||||
const text = String(source || "");
|
||||
let total = 0;
|
||||
for (const matcher of STEP_MATCHERS) {
|
||||
const matches = text.match(matcher.regex);
|
||||
if (matches) total += matches.length;
|
||||
}
|
||||
return Math.max(total, 1);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
STEP_MATCHERS,
|
||||
countScriptSteps,
|
||||
};
|
||||
@@ -1,16 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
const test = require("node:test");
|
||||
const assert = require("node:assert/strict");
|
||||
const { countScriptSteps } = require("./scriptStepCounter.cjs");
|
||||
|
||||
test("countScriptSteps counts common nct calls", () => {
|
||||
const source = `
|
||||
await nct.screen.waitFor('$ ', 5000);
|
||||
await nct.screen.waitForText('ready', 5000);
|
||||
await nct.screen.waitForRegex('READY.*', 5000);
|
||||
await nct.screen.sendLine('ls');
|
||||
nct.log('done');
|
||||
`;
|
||||
assert.equal(countScriptSteps(source), 5);
|
||||
});
|
||||
Reference in new issue
Block a user