wip: start self

This commit is contained in:
Daylin Morgan 2023-05-25 15:39:31 -05:00
parent ed8a4458c9
commit f1b2b14316
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F

View file

@ -49,7 +49,7 @@ from typing import (
Generator,
)
__version__ = "22.12a3-41-g5c40210-dev"
__version__ = "22.12a3-41-gddb03df-dev"
@dataclass
@ -895,11 +895,19 @@ class Viv:
vivenv.dump_info()
def self_manage(self, args: Namespace) -> None:
"""manage viv installation"""
echo("not yet implemented. sorry")
def _get_subcmd_parser(
self, subparsers: _SubParsersAction[ArgumentParser], name: str, **kwargs: Any
self,
subparsers: _SubParsersAction[ArgumentParser],
name: str,
attr: Optional[str] = None,
**kwargs: Any,
) -> ArgumentParser:
aliases = kwargs.pop("aliases", [name[0]])
cmd = getattr(self, name)
cmd = getattr(self, attr if attr else name)
parser: ArgumentParser = subparsers.add_parser(
name,
help=cmd.__doc__.splitlines()[0],
@ -1009,6 +1017,8 @@ class Viv:
parents=[p_vivenv_arg],
)
self._get_subcmd_parser(subparsers, name="self", attr="self_manage")
args = parser.parse_args()
args.func(args)