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

@@ -25,7 +25,7 @@
import os
from .config import load_config
from .libkas import find_program, run_cmd
from .libkas import find_program, run_cmd, kasplugin
from .libcmds import (Macro, Command, SetupDir, SetupProxy,
CleanupSSHAgent, SetupSSHAgent, SetupEnviron,
WriteConfig, SetupHome, ReposFetch,
@@ -35,12 +35,17 @@ __license__ = 'MIT'
__copyright__ = 'Copyright (c) Siemens AG, 2017'
@kasplugin
class Build:
"""
This class implements the build plugin for kas.
"""
def __init__(self, parser):
@classmethod
def get_argparser(cls, parser):
"""
Returns an a parser for the build plugin
"""
bld_psr = parser.add_parser('build')
bld_psr.add_argument('config',