Seperated argument parser creation from main kas entry point

With Sphinx it is possible to create the command line documentation
automatically if there is a function that returns just the command line
parser.

Currently the creation of the argument parser is rather entangled with
the rest of kas. This patches seperates this.

Signed-off-by: Claudius Heine <ch@denx.de>
This commit is contained in:
Claudius Heine
2017-06-28 14:48:41 +02:00
committed by Daniel Wagner
parent 546b51f450
commit 503fd3d47a
4 changed files with 49 additions and 15 deletions

View File

@@ -355,3 +355,12 @@ def ssh_no_host_key_check(_):
os.mkdir(home + '/.ssh')
with open(home + '/.ssh/config', 'w') as fds:
fds.write('Host *\n\tStrictHostKeyChecking no\n\n')
def kasplugin(plugin_class):
"""
A decorator that registeres kas plugins
"""
if not hasattr(kasplugin, 'plugins'):
setattr(kasplugin, 'plugins', [])
getattr(kasplugin, 'plugins').append(plugin_class)