]> git.e2factory.org Git - e2factory.git/commitdiff
policy: wrappers to access command line options
authorTobias Ulmer <tu@emlix.com>
Wed, 24 Apr 2019 16:52:22 +0000 (18:52 +0200)
committerTobias Ulmer <tu@emlix.com>
Wed, 24 Apr 2019 16:52:22 +0000 (18:52 +0200)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
local/policy.lua

index cd32a6454bc4fb6f1a61236252b039cf06761a07..ee9c69c59afec001ad8d946c424ed3b1c1257250 100644 (file)
@@ -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: