Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/trepl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Guo <guorui.xt@gmail.com>2016-10-28 05:36:12 +0300
committerRui Guo <guorui.xt@gmail.com>2016-10-28 05:36:12 +0300
commit9ee945bd8b2e28c011e791fad1af7ddf2a94b238 (patch)
tree49dcb1a9e5a0559e8efc81662949562e844c2498 /init.lua
parent47fec15d184fd613c3e5425f9dd5dbb11adef5fb (diff)
fix for windows with wineditline
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index 167843d..67ab5e4 100644
--- a/init.lua
+++ b/init.lua
@@ -46,10 +46,15 @@ local function isWindows()
package.config:sub(1,1) == '\\'
end
-if isWindows() or (not cutils.isatty()) then
+local hasTPut = true -- default true for non windows
+if isWindows() then
+ hasTPut = sys.fexecute('where tput'):find('tput')
+end
+
+if not hasTPut or not cutils.isatty() then
noColors()
else
- local outp = os.execute('tput colors >/dev/null')
+ local outp = os.execute('tput colors >' .. (isWindows() and 'NUL' or '/dev/null'))
if type(outp) == 'boolean' and not outp then
noColors()
elseif type(outp) == 'number' and outp ~= 0 then
@@ -520,6 +525,10 @@ local aliases = [[
alias lla='ls -lahF';
]]
+if isWindows() then
+ aliases = ""
+end
+
-- Penlight
pcall(require,'pl')