summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-06-15 23:31:46 +0800
committerGitHub <[email protected]>2023-06-15 23:31:46 +0800
commit68153d06e61342aa2be927116c9b7d4e40125945 (patch)
treea5fa1d9ccadd7d10b73e1ff1c0cac7722ff6ada7
parentf504b3ea02891099720b03c6b6464695ebd84d06 (diff)
parentabce659c736b10d94401029dedd6b942ce786f3f (diff)
Merge pull request #3845 from A2va/show-policies
Display policies list in show plugin
-rw-r--r--xmake/plugins/show/lists/policies.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/xmake/plugins/show/lists/policies.lua b/xmake/plugins/show/lists/policies.lua
new file mode 100644
index 000000000..f341ad9b2
--- /dev/null
+++ b/xmake/plugins/show/lists/policies.lua
@@ -0,0 +1,33 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed 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-present, TBOOX Open Source Group.
+--
+-- @author A2va
+-- @file policies.lua
+--
+
+-- imports
+import("core.project.policy")
+
+-- show all policies
+function main()
+ local policies = policy.policies()
+ local width = 45
+
+ for name, policy in pairs(policies) do
+ cprint("${color.dump.string}%s${clear}%s%s", name, (" "):rep(width - #name), policy["description"])
+ cprint("%s${bright}%s", (" "):rep(width), policy["default"] or "false")
+ end
+end