kas: De-duplicate common plugin args

Signed-off-by: Paul Barker <pbarker@konsulko.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Paul Barker 2020-06-15 22:03:28 +02:00 committed by Jan Kiszka
parent a37d72ea7c
commit f0094af79f
3 changed files with 8 additions and 10 deletions

View File

@ -58,8 +58,6 @@ class Build:
Setup the argument parser for the build plugin
"""
parser.add_argument('config',
help='Config file')
parser.add_argument('extra_bitbake_args',
nargs='*',
help='Extra arguments to pass to bitbake')
@ -68,9 +66,6 @@ class Build:
help='Select target to build')
parser.add_argument('-c', '--cmd', '--task', dest='task',
help='Select which task should be executed')
parser.add_argument('--skip',
help='Skip build steps',
default=[])
def run(self, args):
"""

View File

@ -100,6 +100,13 @@ def _atexit_handler():
loop.close()
def setup_parser_common_args(parser):
parser.add_argument('config',
help='Config file')
parser.add_argument('--skip',
help='Skip build steps',
default=[])
def kas_get_argparser():
"""
Creates an argparser for kas with all plugins.
@ -122,6 +129,7 @@ def kas_get_argparser():
for plugin in getattr(kasplugin, 'plugins', []):
plugin_parser = subparser.add_parser(plugin.name, help=plugin.helpmsg)
setup_parser_common_args(plugin_parser)
plugin.setup_parser(plugin_parser)
return parser

View File

@ -56,11 +56,6 @@ class Shell:
Setup the argument parser for the shell plugin
"""
parser.add_argument('config',
help='Config file')
parser.add_argument('--skip',
help='Skip build steps',
default=[])
parser.add_argument('-k', '--keep-config-unchanged',
help='Skip steps that change the configuration',
action='store_true')