diff options
| author | ruki <[email protected]> | 2017-12-07 22:46:25 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-12-08 14:10:23 +0800 |
| commit | cb44535305f596bd757ffb58e5ae3cde6d3589fa (patch) | |
| tree | 343f0ff9287b90204a6a000e0af1a7a1ed6c640b /xmake/core/sandbox | |
| parent | abe87994168053e4f420a8b7ab286c65b546eaae (diff) | |
improve log and add color attrs for curses
Diffstat (limited to 'xmake/core/sandbox')
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/base/object.lua | 26 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/ui/test.lua | 9 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/utils.lua | 14 |
3 files changed, 41 insertions, 8 deletions
diff --git a/xmake/core/sandbox/modules/import/core/base/object.lua b/xmake/core/sandbox/modules/import/core/base/object.lua new file mode 100644 index 000000000..77e724611 --- /dev/null +++ b/xmake/core/sandbox/modules/import/core/base/object.lua @@ -0,0 +1,26 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you under the Apache License, Version 2.0 (the +-- "License"); you may not use this file except in compliance +-- with the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015 - 2017, TBOOX Open Source Group. +-- +-- @author ruki +-- @file object.lua +-- + +-- return module +return require("base/object") diff --git a/xmake/core/sandbox/modules/import/core/ui/test.lua b/xmake/core/sandbox/modules/import/core/ui/test.lua index e4680a67f..6985c0ba1 100644 --- a/xmake/core/sandbox/modules/import/core/ui/test.lua +++ b/xmake/core/sandbox/modules/import/core/ui/test.lua @@ -26,10 +26,17 @@ local sandbox_core_ui_test = sandbox_core_ui_test or {} -- load modules +local log = require("ui/log") +local curses = require("ui/curses") local raise = require("sandbox/modules/raise") function test() + log:flush() + curses.init() + print(curses.color_pair("yellow", "red")) + + --[[ curses.init() local blines = 5 local olines = 10 @@ -70,7 +77,7 @@ function test() if (cmd == 'exit' or string.byte(cmd, 1, 1) == 4) then break end - end + end]] end function sandbox_core_ui_test.main() diff --git a/xmake/core/sandbox/modules/utils.lua b/xmake/core/sandbox/modules/utils.lua index e86eb2c08..bbd4c74c8 100644 --- a/xmake/core/sandbox/modules/utils.lua +++ b/xmake/core/sandbox/modules/utils.lua @@ -60,7 +60,7 @@ function sandbox_utils._print(...) utils._print(unpack(args)) -- write to the log file - log.printv(unpack(args)) + log:printv(unpack(args)) end -- print format string with newline @@ -83,7 +83,7 @@ function sandbox_utils.print(format, ...) utils._print(message) -- write to the log file - log.printv(message) + log:printv(message) end, catch { @@ -110,7 +110,7 @@ function sandbox_utils.printf(format, ...) utils._iowrite(message) -- write log to the log file - log.write(message) + log:write(message) end -- print format string, the builtin variables and colors with newline @@ -123,8 +123,8 @@ function sandbox_utils.cprint(format, ...) utils._print(colors.translate(message)) -- write log to the log file - if log.file() then - log.printv(colors.ignore(message)) + if log:file() then + log:printv(colors.ignore(message)) end end @@ -138,8 +138,8 @@ function sandbox_utils.cprintf(format, ...) utils._iowrite(colors.translate(message)) -- write log to the log file - if log.file() then - log.write(colors.ignore(message)) + if log:file() then + log:write(colors.ignore(message)) end end |
