tests: generalize secret cli parser to work for all cli commands
This commit is contained in:
14
pkgs/clan-cli/tests/helpers/cli.py
Normal file
14
pkgs/clan-cli/tests/helpers/cli.py
Normal 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
|
||||
Reference in New Issue
Block a user