App, .cmds.Cmd: Add .distro property
DistroBase's option --id is now redundant to the new global option --distro-id in the App class, so remove --id. The only added value DistroBase then brings to the table is its .distro property, which can be provided by App just fine at this point, given that App has all it needs to construct a Distro object, so add .distro to App and remove the entire DistroBase class.
For convenience, also make App.distro available as a newly added cmds.Cmd.distro property. This also obviates the need for the distro-related properties in the .distro.Cmd class, remove all that.
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
bd38700f67
commit
18c16917b2
5 changed files with 27 additions and 60 deletions
|
|
@ -4,25 +4,13 @@ from __future__ import annotations
|
|||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import os, importlib
|
||||
|
||||
from ...lib.log import *
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ...lib.Distro import Distro
|
||||
from ..CmdDistro import CmdDistro
|
||||
|
||||
from ..Cmd import Cmd as Base
|
||||
from ..CmdDistro import CmdDistro
|
||||
|
||||
class Cmd(Base): # export
|
||||
|
||||
def __init__(self, parent: CmdDistro, name: str, help: str) -> None:
|
||||
super().__init__(parent, name, help)
|
||||
|
||||
@property
|
||||
def distro(self) -> Distro:
|
||||
return self.parent.distro
|
||||
|
||||
@property
|
||||
def distro_id(self) -> str:
|
||||
return self.parent.distro_id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue