All commands that do load_subcommands() should have a default _run() implementation which calls print_help(), add them.
Signed-off-by: Jan Lindemann <jan@janware.com>
31 lines
731 B
Python
31 lines
731 B
Python
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
from .Cmd import Cmd, Parent
|
|
|
|
if TYPE_CHECKING:
|
|
from argparse import ArgumentParser
|
|
|
|
class CmdPosix(Cmd): # export
|
|
|
|
def __init__(self, parent: Parent) -> None:
|
|
super().__init__(
|
|
parent,
|
|
'posix',
|
|
help = (
|
|
'Perform various operations on a distro through its '
|
|
'POSIX utility interface'
|
|
),
|
|
)
|
|
self.load_subcommands()
|
|
|
|
async def _run(self, args):
|
|
import sys
|
|
|
|
# Missing subcommand
|
|
self.parser.print_help()
|
|
sys.exit(1)
|
|
|
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
|
super().add_arguments(parser)
|