mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
Added command find installed packages
This commit is contained in:
parent
b7c98c6ad1
commit
96a530488b
8 changed files with 52 additions and 6 deletions
|
@ -1,10 +1,11 @@
|
|||
4.1.1 - 22/06/2022
|
||||
4.1.1 - 23/06/2022
|
||||
Updated:
|
||||
- Cli menu view with colors
|
||||
- Switch to yaml configurations
|
||||
Added:
|
||||
- Unittests
|
||||
- Command clean-tmp to deletes all downloaded sources from /tmp/slpkg folder
|
||||
- Command find installed packages
|
||||
|
||||
4.1.0 - 20/06/2022
|
||||
Updated:
|
||||
|
|
|
@ -51,7 +51,8 @@ Usage
|
|||
build <packages> Build only the packages.
|
||||
install <packages> Build and install the packages.
|
||||
remove <packages> Remove installed packages.
|
||||
search <packages> Search packages by name.
|
||||
find <packages> Find installed packages.
|
||||
search <packages> Search packages on repository.
|
||||
clean-logs Clean dependencies log tracking.
|
||||
clean-tmp Deletes all the downloaded sources.
|
||||
|
||||
|
|
|
@ -32,9 +32,14 @@ remove
|
|||
Removes packages with dependencies if the packages was installed with slpkg install method.
|
||||
.RE
|
||||
.P
|
||||
find
|
||||
.RS
|
||||
Find installed packages on your distribution.
|
||||
.RE
|
||||
.P
|
||||
search
|
||||
.RS
|
||||
Search packages by name and view everything in your terminal.
|
||||
Search packages on repository and view everything in your terminal.
|
||||
.RE
|
||||
.P
|
||||
clean-logs
|
||||
|
|
26
slpkg/find_installed.py
Normal file
26
slpkg/find_installed.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
from slpkg.configs import Configs
|
||||
|
||||
|
||||
@dataclass
|
||||
class FindInstalled:
|
||||
log_packages: str = Configs.log_packages
|
||||
colors: dict = Configs.colour
|
||||
|
||||
def find(self, packages: list):
|
||||
matching = []
|
||||
for pkg in packages:
|
||||
for package in os.listdir(self.log_packages):
|
||||
if pkg in package:
|
||||
matching.append(package)
|
||||
self.matched(matching)
|
||||
|
||||
def matched(self, matching: list):
|
||||
color = self.colors()
|
||||
for package in matching:
|
||||
print(f'{color["CYAN"]}{package}{color["ENDC"]}')
|
|
@ -12,6 +12,7 @@ from slpkg.configs import Configs
|
|||
from slpkg.utilities import Utilities
|
||||
from slpkg.views.cli_menu import usage
|
||||
from slpkg.slackbuild import Slackbuilds
|
||||
from slpkg.find_installed import FindInstalled
|
||||
from slpkg.remove_packages import RemovePackages
|
||||
from slpkg.clean_logs import CleanLogsDependencies
|
||||
from slpkg.update_repository import UpdateRepository
|
||||
|
@ -109,6 +110,16 @@ class Argparse:
|
|||
raise SystemExit()
|
||||
usage(1)
|
||||
|
||||
def find(self):
|
||||
if len(self.args) >= 2:
|
||||
packages = list(set(self.args[1:]))
|
||||
packages = self.check.blacklist(packages)
|
||||
|
||||
find = FindInstalled()
|
||||
find.find(packages)
|
||||
raise SystemExit()
|
||||
usage(1)
|
||||
|
||||
def clean_logs(self):
|
||||
if len(self.args) == 1:
|
||||
logs = CleanLogsDependencies(self.flags)
|
||||
|
@ -144,6 +155,7 @@ def main():
|
|||
'install': argparse.install,
|
||||
'remove': argparse.remove,
|
||||
'search': argparse.search,
|
||||
'find': argparse.find,
|
||||
'clean-logs': argparse.clean_logs,
|
||||
'clean-tmp': argparse.clean_tmp
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ from slpkg.models.models import session as Session
|
|||
@dataclass
|
||||
class Search:
|
||||
session: str = Session
|
||||
colors: list = Configs.colour
|
||||
colors: dict = Configs.colour
|
||||
sbo_url: str = Configs.sbo_url
|
||||
|
||||
def package(self, packages):
|
||||
|
|
|
@ -23,7 +23,8 @@ def usage(status: int):
|
|||
f' {CYAN}build{ENDC} <packages> Build only the packages.',
|
||||
f' {CYAN}install{ENDC} <packages> Build and install the packages.',
|
||||
f' {CYAN}remove{ENDC} <packages> Remove installed packages.',
|
||||
f' {CYAN}search{ENDC} <packages> Search packages by name.',
|
||||
f' {CYAN}find{ENDC} <packages> Find installed packages.',
|
||||
f' {CYAN}search{ENDC} <packages> Search packages on repository.',
|
||||
f' {CYAN}clean-logs{ENDC} Clean dependencies log tracking.',
|
||||
f' {CYAN}clean-tmp{ENDC} Delete all the downloaded sources.\n',
|
||||
f'{BOLD}OPTIONS:{ENDC}',
|
||||
|
|
|
@ -15,7 +15,7 @@ from slpkg.models.models import session as Session
|
|||
@dataclass
|
||||
class ViewMessage:
|
||||
flags: list
|
||||
colors: str = Configs.colour
|
||||
colors: dict = Configs.colour
|
||||
log_packages: str = Configs.log_packages
|
||||
repo_tag: str = Configs.repo_tag
|
||||
session: str = Session
|
||||
|
|
Loading…
Add table
Reference in a new issue