cmds.projects.CmdCheck: Move to .check.CmdDep
Move CmdCheck to .check.CmdDep, to make room for more checks under the same "check" parent command. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
5a1ef45cc0
commit
f275aa9715
5 changed files with 65 additions and 14 deletions
|
|
@ -1,6 +1,7 @@
|
|||
from argparse import ArgumentParser, Namespace
|
||||
import sys
|
||||
|
||||
from argparse import ArgumentParser
|
||||
|
||||
from ...lib.log import NOTICE, log
|
||||
from .Cmd import Cmd, Parent
|
||||
|
||||
class CmdCheck(Cmd): # export
|
||||
|
|
@ -9,20 +10,14 @@ class CmdCheck(Cmd): # export
|
|||
super().__init__(
|
||||
parent,
|
||||
'check',
|
||||
help = 'Check for circular dependencies between given modules',
|
||||
help = 'Run miscellaneous code and project checks',
|
||||
)
|
||||
self.load_subcommands()
|
||||
|
||||
def add_arguments(self, parser: ArgumentParser) -> None:
|
||||
super().add_arguments(parser)
|
||||
parser.add_argument('module', nargs = '*', help = 'Modules')
|
||||
parser.add_argument('-f', '--flavour', nargs = '?', default = 'build')
|
||||
|
||||
async def _run(self, args: Namespace) -> None:
|
||||
if self.app.find_circular_deps(args.module, args.flavour):
|
||||
log(NOTICE, f'Found circular dependency in flavour {args.flavour}')
|
||||
exit(1)
|
||||
log(
|
||||
NOTICE,
|
||||
f'No circular dependency found for flavour {args.flavour} in modules:',
|
||||
' '.join(args.module),
|
||||
)
|
||||
async def _run(self, args):
|
||||
# Missing subcommand
|
||||
self.parser.print_help()
|
||||
sys.exit(1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue