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:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index c117c57..b56987c 100644
--- a/init.lua
+++ b/init.lua
@@ -37,6 +37,21 @@ function noColors()
end
end
+local cutils = require 'treplutils'
+
+-- best effort isWindows. Not robust
+local function isWindows()
+ return type(package) == 'table' and
+ type(package.config) == 'string' and
+ package.config:sub(1,1) == '\\'
+end
+
+if isWindows()
+ or (not cutils.isatty())
+or (os.execute('tput colors >/dev/null') ~= 0) then
+ noColors()
+end
+
-- Help string:
local selfhelp = [[
______ __