cmds.secrets.CmdInstall: Add command
Support
jw-pkg secrets install mypasswords.tar.gpg [package-1 [package-2 ...]]
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
b88a8ee299
commit
120a6e4d34
1 changed files with 24 additions and 0 deletions
24
src/python/jw/pkg/cmds/secrets/CmdInstall.py
Normal file
24
src/python/jw/pkg/cmds/secrets/CmdInstall.py
Normal file
|
|
@ -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)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue