2026-04-21 18:11:46 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
from argparse import Namespace, ArgumentParser
|
|
|
|
|
from contextlib import asynccontextmanager
|
|
|
|
|
|
|
|
|
|
from ..Cmd import Cmd as Base
|
|
|
|
|
from ..CmdTar import CmdTar as Parent
|
|
|
|
|
|
|
|
|
|
from ....lib.TarIo import TarIo
|
|
|
|
|
from ....lib.ProcFilterGpg import ProcFilterGpg
|
|
|
|
|
from ....lib.FileContext import FileContext
|
|
|
|
|
|
|
|
|
|
class Cmd(Base): # export
|
|
|
|
|
|
|
|
|
|
def __init__(self, parent: Parent, name: str, help: str) -> None:
|
|
|
|
|
super().__init__(parent, name, help)
|
|
|
|
|
self.__tar_io: None = None
|
|
|
|
|
|
|
|
|
|
@asynccontextmanager
|
|
|
|
|
async def ctx(self, **kwargs) -> TarIo:
|
2026-04-24 13:59:47 +02:00
|
|
|
async with TarIo.create(src=self.app.args.archive_path, **kwargs) as ret:
|
2026-04-21 18:11:46 +02:00
|
|
|
ret.src.add_proc_filter(FileContext.Direction.In, ProcFilterGpg(ec=self.app.exec_context))
|
|
|
|
|
yield ret
|
|
|
|
|
|
|
|
|
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
|
|
|
|
super().add_arguments(parser)
|
|
|
|
|
parser.add_argument('-f', '--archive-path', required=True, help='Archive path')
|