mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-01-24 06:51:27 +01:00
Merge pull request #3158 from Master-Guy/features/2462
Tabelize linked output of `ls`
This commit is contained in:
commit
8faacfc4ef
@ -139,10 +139,9 @@ export function ls(
|
||||
}),
|
||||
)();
|
||||
|
||||
const rowSplit = row
|
||||
.split(" ")
|
||||
.map((x) => x.trim())
|
||||
.filter((x) => !!x);
|
||||
const rowSplit = row.split("~");
|
||||
let rowSplitArray = rowSplit.map((x) => [x.trim(), x.replace(x.trim(), "")]);
|
||||
rowSplitArray = rowSplitArray.filter((x) => !!x[0]);
|
||||
|
||||
function onScriptLinkClick(filename: string): void {
|
||||
if (player.getCurrentServer().hostname !== hostname) {
|
||||
@ -156,9 +155,14 @@ export function ls(
|
||||
|
||||
return (
|
||||
<span className={classes.scriptLinksWrap}>
|
||||
{rowSplit.map((rowItem) => (
|
||||
<span key={rowItem} className={classes.scriptLink} onClick={() => onScriptLinkClick(rowItem)}>
|
||||
{rowItem}
|
||||
{rowSplitArray.map((rowItem) => (
|
||||
<span>
|
||||
<span key={rowItem[0]} className={classes.scriptLink} onClick={() => onScriptLinkClick(rowItem[0])}>
|
||||
{rowItem[0]}
|
||||
</span>
|
||||
<span key={'s'+rowItem[0]}>
|
||||
{rowItem[1]}
|
||||
</span>
|
||||
</span>
|
||||
))}
|
||||
</span>
|
||||
@ -174,6 +178,9 @@ export function ls(
|
||||
if (!(i < segments.length)) break;
|
||||
row += segments[i];
|
||||
row += " ".repeat(maxLength * (col + 1) - row.length);
|
||||
if(linked) {
|
||||
row += "~";
|
||||
}
|
||||
i++;
|
||||
}
|
||||
i--;
|
||||
|
Loading…
Reference in New Issue
Block a user