summaryrefslogtreecommitdiff
path: root/xmake/plugins/lua/xmake.lua
diff options
context:
space:
mode:
authorTitanSnow <[email protected]>2017-05-10 16:12:22 +0800
committerTitanSnow <[email protected]>2017-05-10 16:12:22 +0800
commitf8229f6c4344b78685194193fea070f0c9fe3f33 (patch)
tree5b51728458cf4d239beff5f51aa5b4a6308f968c /xmake/plugins/lua/xmake.lua
parent5894c5279ca8fc5757eb697bfd901889a4b9e065 (diff)
Revert "check feature readline before load/save replhistory"
This reverts commit 0f44fc860f5481893bfe46c9339be953533aef8b.
Diffstat (limited to 'xmake/plugins/lua/xmake.lua')
-rw-r--r--xmake/plugins/lua/xmake.lua40
1 files changed, 16 insertions, 24 deletions
diff --git a/xmake/plugins/lua/xmake.lua b/xmake/plugins/lua/xmake.lua
index efa044f4b..bef62203b 100644
--- a/xmake/plugins/lua/xmake.lua
+++ b/xmake/plugins/lua/xmake.lua
@@ -34,11 +34,8 @@ task("lua")
-- imports
import("core.base.option")
import("core.sandbox.sandbox")
- local enable_readline = os.versioninfo().features.readline
- if enable_readline then
- import("core.project.history")
- import("lib.readline")
- end
+ import("core.project.history")
+ import("lib.readline")
-- list all scripts?
if option.get("list") then
@@ -61,33 +58,28 @@ task("lua")
import("scripts." .. name).main(unpack(option.get("arguments") or {}))
end
else
- local replhistory
- if enable_readline then
- -- clear history
- readline.clear_history()
+ -- clear history
+ readline.clear_history()
- -- load history
- replhistory = history.load("replhistory") or {}
- for _, ln in ipairs(replhistory) do
- readline.add_history(ln)
- end
+ -- load history
+ local replhistory = history.load("replhistory") or {}
+ for _, ln in ipairs(replhistory) do
+ readline.add_history(ln)
end
-- enter interactive mode
sandbox.interactive()
- if enable_readline then
- -- save to history
- local entries = readline.history_list()
- if #entries > #replhistory then
- for i = #replhistory+1, #entries do
- history.save("replhistory", entries[i].line)
- end
+ -- save to history
+ local entries = readline.get_history_state().entries
+ if #entries > #replhistory then
+ for i = #replhistory+1, #entries do
+ history.save("replhistory", entries[i].line)
end
-
- -- clear history
- readline.clear_history()
end
+
+ -- clear history
+ readline.clear_history()
end
end)