jw-pkg/src/python/jw/pkg/cmds/distro/CmdInstall.py

22 lines
1,012 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
from argparse import Namespace, ArgumentParser
from .Cmd import Cmd
from ..CmdDistro import CmdDistro
class CmdInstall(Cmd): # export
def __init__(self, parent: CmdDistro) -> None:
super().__init__(parent, 'install', help="Install the distribution's notion of available packages")
def add_arguments(self, parser: ArgumentParser) -> None:
super().add_arguments(parser)
parser.add_argument("names", nargs="*", help="Packages to be installed")
parser.add_argument('--only-update', default=False, action='store_true', help='Only update the listed packages, don\'t install them')
parser.add_argument('-F', '--fixed-strings', action='store_true',
help='Don\'t expand platform info macros in <names>')
async def _run(self, args: Namespace) -> None:
names = names if args.fixed_strings else self.app.distro_info(args.names)
return await self.distro.install(names, only_update=args.only_update)