tests: generalize secret cli parser to work for all cli commands

This commit is contained in:
Jörg Thalheim
2023-08-24 17:29:31 +02:00
parent 3b099ccb89
commit d600a927ea
5 changed files with 71 additions and 75 deletions

View File

@@ -0,0 +1,14 @@
import argparse
from clan_cli import create_parser
class Cli:
def __init__(self) -> None:
self.parser = create_parser(prog="clan")
def run(self, args: list[str]) -> argparse.Namespace:
parsed = self.parser.parse_args(args)
if hasattr(parsed, "func"):
parsed.func(parsed)
return parsed