diff --git a/src/python/jw/pkg/cmds/secrets/CmdInstall.py b/src/python/jw/pkg/cmds/secrets/CmdInstall.py new file mode 100644 index 00000000..3175391a --- /dev/null +++ b/src/python/jw/pkg/cmds/secrets/CmdInstall.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +from __future__ import annotations +from typing import TYPE_CHECKING + +from .Cmd import Cmd + +if TYPE_CHECKING: + from ..CmdSecrets import CmdSecrets + from argparse import Namespace, ArgumentParser + +class CmdInstall(Cmd): # export + + def __init__(self, parent: CmdSecrets) -> None: + super().__init__(parent, 'install', help='Install secrets from various sources as static secrets onto the target') + + def add_arguments(self, parser: ArgumentParser) -> None: + parser.add_argument('src', help='URI of secret source') + parser.add_argument('--only-missing', action='store_true', default=False, help='Install only secrets not already on the target') + super().add_arguments(parser) + + async def _run(self, args: Namespace) -> None: + packages = [] if args.packages == ['all'] else args.packages + await self.ctx.install(args.src, packages, args.only_missing)