summaryrefslogtreecommitdiff
path: root/xmake/plugins/echo
diff options
context:
space:
mode:
authorruki <[email protected]>2017-02-09 23:05:36 +0800
committerruki <[email protected]>2017-02-09 23:05:36 +0800
commit565cbde5d77b6516b103de666384bf652ad9e1f2 (patch)
tree7ac3b6363152267f3b86fbe8675093b3a64dc035 /xmake/plugins/echo
parentac4475402fae09351f4602b03750b540e69e5d3f (diff)
add task api docs
Diffstat (limited to 'xmake/plugins/echo')
-rwxr-xr-xxmake/plugins/echo/xmake.lua76
1 files changed, 76 insertions, 0 deletions
diff --git a/xmake/plugins/echo/xmake.lua b/xmake/plugins/echo/xmake.lua
new file mode 100755
index 000000000..a593a9f82
--- /dev/null
+++ b/xmake/plugins/echo/xmake.lua
@@ -0,0 +1,76 @@
+--!The Make-like 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 echo.lua
+--
+
+-- define task
+task("echo")
+
+ -- set category
+ set_category("plugin")
+
+ -- on run
+ on_run(function ()
+
+ -- imports
+ import("core.base.option")
+
+ -- init modes
+ local modes = ""
+ for _, mode in ipairs({"bright", "dim", "blink", "reverse"}) do
+ if option.get(mode) then
+ modes = modes .. " " .. mode
+ end
+ end
+
+ -- echo info
+ cprint("${%s%s}%s", option.get("color"), modes, table.concat(option.get("contents") or {}, " "))
+ end)
+
+ -- set menu
+ set_menu {
+ -- usage
+ usage = "xmake echo [options]"
+
+ -- description
+ , description = "Echo the given info!"
+
+ -- options
+ , options =
+ {
+ {'b', "bright", "k", nil, "Enable bright." }
+ , {'d', "dim", "k", nil, "Enable dim." }
+ , {'-', "blink", "k", nil, "Enable blink." }
+ , {'r', "reverse", "k", nil, "Reverse color." }
+ , {}
+ , {'c', "color", "kv", "black", "Set the output color."
+ , " - red"
+ , " - blue"
+ , " - yellow"
+ , " - green"
+ , " - magenta"
+ , " - cyan"
+ , " - white" }
+ , {}
+ , {nil, "contents", "vs", nil, "The info contents." }
+ }
+ }