mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-02-05 08:46:20 +01:00
Fixed for type hints
This commit is contained in:
parent
924685b15f
commit
18bbc97285
2 changed files with 12 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import shutil
|
||||
from typing import Generator
|
||||
from packaging.version import parse, InvalidVersion
|
||||
from pathlib import Path
|
||||
|
@ -30,6 +31,8 @@ class Upgrade(Configs):
|
|||
self.installed_names: list = []
|
||||
self.installed_packages: list = []
|
||||
|
||||
self.columns, self.rows = shutil.get_terminal_size()
|
||||
|
||||
def load_installed_packages(self, repository: str) -> None:
|
||||
if repository == self.repos.slack_repo_name:
|
||||
extra_repo: dict = {}
|
||||
|
@ -192,7 +195,12 @@ class Upgrade(Configs):
|
|||
|
||||
if found_packages:
|
||||
print()
|
||||
title: str = f"{'packages':<18} {'Repository':<15} {'Build':<6} {'Installed':<15} {'Build':<5} {'Repo':>15}"
|
||||
|
||||
pkg_alignment: int = 18
|
||||
if self.columns > 80:
|
||||
pkg_alignment: int = (self.columns - 80) + 18
|
||||
|
||||
title: str = f"{'packages':<{pkg_alignment}} {'Repository':<15} {'Build':<6} {'Installed':<15} {'Build':<5} {'Repo':>15}"
|
||||
print(len(title) * '=')
|
||||
print(f'{self.bgreen}{title}{self.endc}')
|
||||
print(len(title) * '=')
|
||||
|
@ -206,7 +214,7 @@ class Upgrade(Configs):
|
|||
repo: str = data['repo']
|
||||
mode: str = data['type']
|
||||
|
||||
if len(name) > 17:
|
||||
if len(name) > pkg_alignment:
|
||||
name: str = f'{name[:14]}...'
|
||||
if len(inst_version) > 15:
|
||||
inst_version: str = f"{inst_version[:11]}..."
|
||||
|
@ -219,7 +227,7 @@ class Upgrade(Configs):
|
|||
if mode == 'add':
|
||||
color: str = self.cyan
|
||||
|
||||
print(f"{color}{name:<18}{self.endc} {repo_version:<15} {repo_build:<6} {inst_version:<15} "
|
||||
print(f"{color}{name:<{pkg_alignment}}{self.endc} {repo_version:<15} {repo_build:<6} {inst_version:<15} "
|
||||
f"{inst_build:<5} {repo:>15}")
|
||||
|
||||
print(len(title) * '=')
|
||||
|
|
|
@ -19,7 +19,7 @@ class View(Configs):
|
|||
if flags is None:
|
||||
flags: list = []
|
||||
self.flags: list = flags
|
||||
self.repository = repository
|
||||
self.repository: str = repository
|
||||
self.data: dict = data
|
||||
|
||||
self.repos = Repositories()
|
||||
|
|
Loading…
Add table
Reference in a new issue