NETSCRIPT: Add the 'cat' method to 'ns.singularity' (#1999)

This commit is contained in:
Naga
2025-03-23 03:04:26 -04:00
committed by GitHub
parent 70a083b34b
commit 1539c428bc
5 changed files with 46 additions and 0 deletions
+7
View File
@@ -52,6 +52,7 @@ import { calculateEffectiveRequiredReputation } from "../Company/utils";
import { calculateFavorAfterResetting } from "../Faction/formulas/favor";
import { validBitNodes } from "../BitNode/BitNodeUtils";
import { exceptionAlert } from "../utils/helpers/exceptionAlert";
import { cat } from "../Terminal/commands/cat";
export function NetscriptSingularity(): InternalAPI<ISingularity> {
const runAfterReset = function (cbScript: ScriptFilePath) {
@@ -467,6 +468,12 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
helpers.checkSingularityAccess(ctx);
return Player.getCurrentServer().hostname;
},
cat: (ctx) => (_filename) => {
helpers.checkSingularityAccess(ctx);
const filename = helpers.string(ctx, "filename", _filename);
const server = Player.getCurrentServer();
cat([filename], server);
},
connect: (ctx) => (_hostname) => {
helpers.checkSingularityAccess(ctx);
const hostname = helpers.string(ctx, "hostname", _hostname);