mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-30 12:57:06 +02:00
PIPE: Add pipe support for passing data into and out of terminal commands (#2395)
This commit is contained in:
committed by
GitHub
parent
4a22e16058
commit
92b8b58588
@@ -1,11 +1,15 @@
|
||||
import { trimQuotes } from "../utils/helpers/string";
|
||||
import { substituteAliases } from "../Alias";
|
||||
import { Terminal } from "../Terminal";
|
||||
// Helper function to parse individual arguments into number/boolean/string as appropriate
|
||||
function parseArg(arg: string): string | number | boolean {
|
||||
if (arg === "true") return true;
|
||||
if (arg === "false") return false;
|
||||
const argAsNumber = Number(arg);
|
||||
if (!isNaN(argAsNumber)) return argAsNumber;
|
||||
if (arg === "$!") {
|
||||
return Terminal.pidOfLastScriptRun ?? -1;
|
||||
}
|
||||
return trimQuotes(arg);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user