diff --git a/css/terminal.scss b/css/terminal.scss index 856df717c..1bd63a829 100644 --- a/css/terminal.scss +++ b/css/terminal.scss @@ -56,6 +56,12 @@ display: flex; } +#terminal-input-td textarea { + overflow: hidden; + resize:none; + height:auto; +} + #terminal-input-header { white-space: pre; } diff --git a/doc/source/changelog.rst b/doc/source/changelog.rst index 1d3ec509a..5cf080c28 100644 --- a/doc/source/changelog.rst +++ b/doc/source/changelog.rst @@ -17,9 +17,9 @@ v0.40.2 - 8/27/2018 * There are now, on average, more Synthoid communities in a city * If automation is enabled (the feature in Bladeburner console), then switching to another action such as working for a company will now disable the automation * Stock Market Changes: - *Added a watchlist filter feature to the UI that allows you to specify which stocks to show - *Added the Four Sigma (4S) Market Data feed, which provides volatility and price forecast information about stocks - *Added the 4S Market Data TIX API, which lets you access the aforementioned data through Netscript + * Added a watchlist filter feature to the UI that allows you to specify which stocks to show + * Added the Four Sigma (4S) Market Data feed, which provides volatility and price forecast information about stocks + * Added the 4S Market Data TIX API, which lets you access the aforementioned data through Netscript * There is now a setting for enabling/disabling the popup that appears when you are hospitalized * Bug Fix: Stock market should now be correctly initialized in BitNode-8 (by Kline-) * Bug Fix: bladeburner.getCurrentAction() should now properly an 'Idle' object rather than null (by Kline-) diff --git a/doc/source/terminal.rst b/doc/source/terminal.rst index dcdd0a9c7..257f7542f 100644 --- a/doc/source/terminal.rst +++ b/doc/source/terminal.rst @@ -412,3 +412,18 @@ Then it could be removed using:: $ unalias "r" It is not necessary to differentiate between global and non-global aliases when using 'unalias' + +wget +^^^^ + + $ wget [url] [target file] + +Retrieves data from a url and downloads it to a file on the current server. +The data can only be downloaded to a script (.script, .ns, .js) or a text file +(.txt). If the target file already exists, it will be overwritten by this command. + +Note that will not be possible to download data from many websites because they +do not allow cross-origin origin sharing (CORS). This includes websites such +as gist and pastebin. One notable site it will work on is rawgithub. Example:: + + $ wget https://raw.githubusercontent.com/danielyxie/bitburner/master/README.md game_readme.txt diff --git a/netscript.js b/netscript.js index b632dfdaa..8d7e2ec16 100644 --- a/netscript.js +++ b/netscript.js @@ -101,7 +101,7 @@ let NetscriptFunctions = "getActionMaxLevel|getActionCurrentLevel|getActionAutolevel|" + "setActionAutolevel|setActionLevel|" + "getRank|getSkillPoints|getSkillLevel|getSkillUpgradeCost|" + - "upgradeSkill|getTeamSize|" + + "upgradeSkill|getTeamSize|getCity|" + "setTeamSize|getCityEstimatedPopulation|getCityEstimatedCommunities|" + "getCityChaos|switchCity|getStamina|joinBladeburnerFaction|getBonusTime"; diff --git a/package-lock.json b/package-lock.json index ceff05e84..7de055c9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -608,6 +608,11 @@ "postcss-value-parser": "3.3.0" } }, + "autosize": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/autosize/-/autosize-4.0.2.tgz", + "integrity": "sha512-jnSyH2d+qdfPGpWlcuhGiHmqBJ6g3X+8T+iRwFrHPLVcdoGJE/x6Qicm6aDHfTsbgZKxyV8UU/YB2p4cjKDRRA==" + }, "aws-sign2": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", diff --git a/package.json b/package.json index 49ee37f7f..fd98ddd96 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "ajv": "^5.1.5", "ajv-keywords": "^2.0.0", "async": "^2.6.1", + "autosize": "^4.0.2", "bluebird": "^3.5.1", "brace": "^0.11.1", "decimal.js": "7.2.3", diff --git a/src/Constants.js b/src/Constants.js index 530bbeb61..9a405122c 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -511,6 +511,8 @@ let CONSTANTS = { * Updated documentation to reflect the fact that Netscript port handles (getPortHandle()) only works in NetscriptJS (2.0), NOT Netscript 1.0
* Added tryWrite() Netscript function
* When working (for a company/faction), experience is gained immediately/continuously rather than all at once when the work is finished
+ * Added a setting in .fconf for enabling line-wrap in the Terminal input
+ * Added 'wget' Terminal command
* Improved the introductory tutorial` } diff --git a/src/Fconf.js b/src/Fconf.js index 77cddf622..be3729360 100644 --- a/src/Fconf.js +++ b/src/Fconf.js @@ -1,8 +1,9 @@ import {parse, Node} from "../utils/acorn"; var FconfSettings = { - ENABLE_BASH_HOTKEYS: false, - ENABLE_TIMESTAMPS: false, + ENABLE_BASH_HOTKEYS: false, + ENABLE_TIMESTAMPS: false, + WRAP_INPUT: false, } var FconfComments = { @@ -15,6 +16,11 @@ var FconfComments = { "http://bitburner.readthedocs.io/en/latest/shortcuts.html", ENABLE_TIMESTAMPS: "Terminal commands and log entries will be timestamped. The timestamp\n" + "will have the format: M/D h:m", + WRAP_INPUT: "Wrap Terminal Input. If this is enabled, then when a Terminal command is\n" + + "too long and overflows, then it will wrap to the next line instead of\n" + + "side-scrolling\n\n" + + "Note that after you enable/disable this, you'll have to run a command\n" + + "before its effect takes place.", } //Parse Fconf settings from the config text @@ -74,6 +80,7 @@ function parseFconfSetting(setting, value) { switch(setting) { case "ENABLE_BASH_HOTKEYS": case "ENABLE_TIMESTAMPS": + case "WRAP_INPUT": var value = value.toLowerCase(); if (value === "1" || value === "true" || value === "y") { value = true; diff --git a/src/HelpText.ts b/src/HelpText.ts index ff88a21ce..0c5bfaf76 100644 --- a/src/HelpText.ts +++ b/src/HelpText.ts @@ -32,7 +32,8 @@ export const TerminalHelpText: string = "tail [script] [args...] Displays dynamic logs for the specified script
" + "theme [preset] | bg txt hlgt Change the color scheme of the UI
" + "top Displays all running scripts and their RAM usage
" + - 'unalias "[alias name]" Deletes the specified alias
'; + 'unalias "[alias name]" Deletes the specified alias
' + + 'wget [url] [target file] Retrieves code/text from a web server
'; interface IMap { [key: string]: T; @@ -214,5 +215,11 @@ export const HelpTexts: IMap = { "Then it could be removed using:

" + 'unalias "r"

' + "It is not necessary to differentiate between global and non-global aliases when using 'unalias'", - + wget: "wget [url] [target file]
" + + "Retrieves data from a URL and downloads it to a file on the current server. The data can only " + + "be downloaded to a script (.script, .ns, .js) or a text file (.txt). If the file already exists, " + + "it will be overwritten by this command.

" + + "Note that it will not be possible to download data from many websites because they do not allow " + + "cross-origin resource sharing (CORS). Example:

" + + "wget https://raw.githubusercontent.com/danielyxie/bitburner/master/README.md game_readme.txt", }; diff --git a/src/SaveObject.js b/src/SaveObject.js index 1c3eae367..bf4bb9be2 100644 --- a/src/SaveObject.js +++ b/src/SaveObject.js @@ -451,7 +451,7 @@ function loadImportedGame(saveObj, saveString) { var popupId = "import-game-restart-game-notice"; var txt = createElement("p", { - innerText:"Imported game! I would suggest saving the game and then reloading the page " + + innerText:"Imported game! You need to SAVE the game and then RELOAD the page " + "to make sure everything runs smoothly" }); var gotitBtn = createElement("a", { diff --git a/src/Terminal.js b/src/Terminal.js index ea575513b..def530d1c 100644 --- a/src/Terminal.js +++ b/src/Terminal.js @@ -50,6 +50,7 @@ import {yesNoBoxCreate, import {post, hackProgressBarPost, hackProgressPost} from "./ui/postToTerminal"; +import autosize from 'autosize'; import * as JSZip from 'jszip'; import * as FileSaver from 'file-saver'; @@ -66,8 +67,8 @@ $(document).keydown(function(event) { if (event.keyCode === KEY.ENTER) { event.preventDefault(); //Prevent newline from being entered in Script Editor - var command = $('input[class=terminal-input]').val(); - post( + var command = terminalInput.value; + post( "[" + (FconfSettings.ENABLE_TIMESTAMPS ? getTimestamp() + " " : "") + Player.getCurrentServer().hostname + @@ -524,9 +525,18 @@ let Terminal = { commandHistoryIndex: 0, resetTerminalInput: function() { - document.getElementById("terminal-input-td").innerHTML = - "
[" + Player.getCurrentServer().hostname + " ~]" + "$
" + - ''; + if (FconfSettings.WRAP_INPUT) { + document.getElementById("terminal-input-td").innerHTML = + "
[" + Player.getCurrentServer().hostname + " ~]" + "$
" + + '