[elbe-devel] [PATCH v2 4/7] commands preprocess: isolate "pass_through" options
Torben Hohn
torben.hohn at linutronix.de
Mon Oct 15 12:43:17 CEST 2018
"elbe preprocess" will be called from "elbe initvm" and "elbe pbuilder"
in order to forward options these commands have to define them too.
Add a function, that adds the forwardable options to an option parser.
Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
elbepack/commands/preprocess.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/elbepack/commands/preprocess.py b/elbepack/commands/preprocess.py
index 73fc71cb..44e298c4 100644
--- a/elbepack/commands/preprocess.py
+++ b/elbepack/commands/preprocess.py
@@ -12,14 +12,18 @@ from optparse import OptionParser
from elbepack.xmlpreprocess import XMLPreprocessError, xmlpreprocess
+def add_pass_through_options(oparser):
+ oparser.add_option("-v", "--variants", dest="variant",
+ default=None,
+ help="enable only tags with empty or given variant")
+
+
def run_command(argv):
oparser = OptionParser(usage="usage: %prog preprocess [options] <xmlfile>")
oparser.add_option("-o", "--output", dest="output",
default="preprocess.xml",
help="preprocessed output file", metavar="<xmlfile>")
- oparser.add_option("-v", "--variants", dest="variant",
- default=None,
- help="enable only tags with empty or given variant")
+ add_pass_through_options(oparser)
(opt, args) = oparser.parse_args(argv)
if len(args) != 1:
--
2.11.0
More information about the elbe-devel
mailing list