mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-19 12:17:17 -04:00
Made Histrory Length a EnvVar
Well, there is it!
This commit is contained in:
parent
fe08db56cc
commit
8ca7306f34
@ -7,6 +7,14 @@ local shell = require("shell")
|
||||
local term = require("term")
|
||||
local text = require("text")
|
||||
|
||||
local function getHistSize()
|
||||
if os.getenv("HISTSIZE") then
|
||||
return os.getenv("HISTSIZE")
|
||||
else
|
||||
return 10
|
||||
end
|
||||
end
|
||||
|
||||
local function expand(value)
|
||||
local result = value:gsub("%$(%w+)", os.getenv):gsub("%$%b{}",
|
||||
function(match) return os.getenv(expand(match:sub(3, -2))) or match end)
|
||||
@ -165,7 +173,7 @@ if #args == 0 and (io.input() == io.stdin or options.i) and not options.c then
|
||||
term.write("exit\n")
|
||||
return -- eof
|
||||
end
|
||||
while #history > 20 do
|
||||
while #history > getHistSize() do
|
||||
table.remove(history, 1)
|
||||
end
|
||||
command = text.trim(command)
|
||||
|
@ -16,6 +16,7 @@ local env = {
|
||||
SHELL="/bin/sh",
|
||||
TMP="/tmp", -- Depricated
|
||||
TMPDIR="/tmp"
|
||||
HISTSIZE=10
|
||||
}
|
||||
|
||||
os.execute = function(command)
|
||||
|
Loading…
x
Reference in New Issue
Block a user