From 4cd48dc98bc2fe8fd5c48e47a6650ec9556bb441 Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Wed, 24 Apr 2019 18:52:22 +0200 Subject: [PATCH] policy: wrappers to access command line options Signed-off-by: Tobias Ulmer --- local/policy.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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: -- 2.39.5