From: Tobias Ulmer Date: Wed, 24 Apr 2019 16:52:22 +0000 (+0200) Subject: policy: wrappers to access command line options X-Git-Tag: e2factory-2.3.18rc1~10 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=4cd48dc98bc2fe8fd5c48e47a6650ec9556bb441;p=e2factory.git policy: wrappers to access command line options Signed-off-by: Tobias Ulmer --- diff --git a/local/policy.lua b/local/policy.lua index cd32a64..ee9c69c 100644 --- a/local/policy.lua +++ b/local/policy.lua @@ -304,6 +304,30 @@ function policy.default_build_mode(mode) return strict.lock(build_mode) end +-- Accessing the e2option.opts table directly is quite error prone, +-- thus this set of trivial wrapper functions. +policy.opts = {} + +--- Query the 'check' flag +-- @return true or false +function policy.opts.check() + return e2option.opts['check'] or false +end + +--- Query the 'check-remote' flag +-- @return true or false +function policy.opts.check_remote() + return e2option.opts['check-remote'] or false +end + +--- Query build-mode option +-- @return one of "tag", "release", "branch", "working-copy" +function policy.opts.build_mode() + assertIsStringN(e2option.opts["build-mode"]) + return e2option.opts['build-mode'] +end + +strict.lock(policy.opts) return strict.lock(policy) -- vim:sw=4:sts=4:et: