mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-01-10 15:27:32 +01:00
Rebased
Added hostname to tab name Removed -tas arg from the rm command
This commit is contained in:
parent
9c19ddf6a7
commit
e5c4c8f64b
@ -197,6 +197,13 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
editorRef.current.getAction("editor.action.formatDocument").run();
|
editorRef.current.getAction("editor.action.formatDocument").run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// How to load function definition in monaco
|
||||||
|
// https://github.com/Microsoft/monaco-editor/issues/1415
|
||||||
|
// https://microsoft.github.io/monaco-editor/api/modules/monaco.languages.html
|
||||||
|
// https://www.npmjs.com/package/@monaco-editor/react#development-playground
|
||||||
|
// https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-custom-languages
|
||||||
|
// https://github.com/threehams/typescript-error-guide/blob/master/stories/components/Editor.tsx#L11-L39
|
||||||
|
// https://blog.checklyhq.com/customizing-monaco/
|
||||||
// Before the editor is mounted
|
// Before the editor is mounted
|
||||||
function beforeMount(monaco: any): void {
|
function beforeMount(monaco: any): void {
|
||||||
if (symbolsLoaded) return;
|
if (symbolsLoaded) return;
|
||||||
@ -508,10 +515,10 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
PromptEvent.emit({
|
PromptEvent.emit({
|
||||||
txt: 'Do you want to save changes to ' + closingScript.fileName + '?',
|
txt: 'Do you want to save changes to ' + closingScript.fileName + '?',
|
||||||
resolve: (result: boolean) => {
|
resolve: (result: boolean) => {
|
||||||
if(result) {
|
if (result) {
|
||||||
// Save changes
|
// Save changes
|
||||||
closingScript.code = savedScriptCode;
|
closingScript.code = savedScriptCode;
|
||||||
saveScript(closingScript);
|
saveScript(closingScript);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -556,7 +563,6 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
maxWidth="1640px"
|
maxWidth="1640px"
|
||||||
display="flex"
|
display="flex"
|
||||||
flexDirection="row"
|
flexDirection="row"
|
||||||
//overflow="auto"
|
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
whiteSpace="nowrap"
|
whiteSpace="nowrap"
|
||||||
ref={provided.innerRef}
|
ref={provided.innerRef}
|
||||||
@ -582,7 +588,7 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
onClick={() => onTabClick(index)}
|
onClick={() => onTabClick(index)}
|
||||||
style={{ background: currentScript?.fileName === openScripts[index].fileName ? Settings.theme.secondarydark : '' }}
|
style={{ background: currentScript?.fileName === openScripts[index].fileName ? Settings.theme.secondarydark : '' }}
|
||||||
>
|
>
|
||||||
{fileName}
|
{hostname}:~/{fileName}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
id={"tabCloseButton" + fileName + hostname}
|
id={"tabCloseButton" + fileName + hostname}
|
||||||
@ -653,7 +659,7 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: currentScript !== null ? 'none' : 'flex', height: '100%', width: '100%', justifyContent: 'center', alignItems: 'center' }}>
|
<div style={{ display: currentScript !== null ? 'none' : 'flex', height: '100%', width: '100%', justifyContent: 'center', alignItems: 'center' }}>
|
||||||
<p style={{ color: Settings.theme.primary, fontSize: '20px', textAlign: 'center' }}><h1>No open files</h1><h5>Use "nano [File Name]" in the terminal to open files</h5></p>
|
<p style={{ color: Settings.theme.primary, fontSize: '20px', textAlign: 'center' }}><h1>No open files</h1><h5>Use "nano [File Name]" in the terminal to open files</h5></p>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
@ -11,7 +11,7 @@ export function rm(
|
|||||||
server: BaseServer,
|
server: BaseServer,
|
||||||
args: (string | number | boolean)[],
|
args: (string | number | boolean)[],
|
||||||
): void {
|
): void {
|
||||||
if (args.length < 1) {
|
if (args.length !== 1) {
|
||||||
terminal.error("Incorrect number of arguments. Usage: rm [program/script]");
|
terminal.error("Incorrect number of arguments. Usage: rm [program/script]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -25,14 +25,6 @@ export function rm(
|
|||||||
try {
|
try {
|
||||||
delTarget = terminal.getFilepath(args[0] + "");
|
delTarget = terminal.getFilepath(args[0] + "");
|
||||||
status = server.removeFile(delTarget);
|
status = server.removeFile(delTarget);
|
||||||
|
|
||||||
// Check if we should remove it from both the text and script arrays
|
|
||||||
if(args[1] === '-tas') {
|
|
||||||
let fileIndex = server.scripts.findIndex(script => script.filename === (args[0] + ""));
|
|
||||||
if(fileIndex !== -1) {
|
|
||||||
server.scripts.splice(fileIndex, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
status = {
|
status = {
|
||||||
res: false,
|
res: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user