mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-30 20:34:38 +01:00
Added a new search command
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
bdc9f3ae83
commit
72249c0f1e
6 changed files with 45 additions and 2 deletions
|
@ -3,6 +3,8 @@ Updated:
|
||||||
- Removed version for skip installed option
|
- Removed version for skip installed option
|
||||||
- Removed unused configurations
|
- Removed unused configurations
|
||||||
- Search command to view
|
- Search command to view
|
||||||
|
Added:
|
||||||
|
- A new search command to search and match packages from the repository
|
||||||
|
|
||||||
4.2.1 - 18/10/2022
|
4.2.1 - 18/10/2022
|
||||||
Added:
|
Added:
|
||||||
|
|
|
@ -56,6 +56,7 @@ Usage
|
||||||
remove <packages> Remove installed packages.
|
remove <packages> Remove installed packages.
|
||||||
find <packages> Find installed packages.
|
find <packages> Find installed packages.
|
||||||
view <packages> View packages from the repository.
|
view <packages> View packages from the repository.
|
||||||
|
search <packages> Search packages from the repository.
|
||||||
clean-logs Clean dependencies log tracking.
|
clean-logs Clean dependencies log tracking.
|
||||||
clean-tmp Deletes all the downloaded sources.
|
clean-tmp Deletes all the downloaded sources.
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
slpkg - [OPTIONS] [COMMAND] <packages>
|
slpkg - [OPTIONS] [COMMAND] <packages>
|
||||||
.SH SYNAPSES
|
.SH SYNAPSES
|
||||||
.P
|
.P
|
||||||
slpkg [-h|-v] [update] [upgrade] [build] [install] [download] [remove] [find] [view] [clean-logs] [clean-tmp] --yes --jobs --resolve-off --reinstall --skip-installed
|
slpkg [-h|-v] [update] [upgrade] [build] [install] [download] [remove] [find] [view] [search] [clean-logs] [clean-tmp] --yes --jobs --resolve-off --reinstall --skip-installed
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.P
|
.P
|
||||||
Slpkg is a software package manager that installs, updates, and removes packages on Slackware based systems. It automatically computes dependencies and figures out what things should occur to install packages. Slpkg makes it easier to maintain groups of machines without having to manually update.
|
Slpkg is a software package manager that installs, updates, and removes packages on Slackware based systems. It automatically computes dependencies and figures out what things should occur to install packages. Slpkg makes it easier to maintain groups of machines without having to manually update.
|
||||||
|
@ -52,6 +52,11 @@ view
|
||||||
View packages from the repository and get everything in your terminal.
|
View packages from the repository and get everything in your terminal.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
|
search
|
||||||
|
.RS
|
||||||
|
Search and match packages from the repository.
|
||||||
|
.RE
|
||||||
|
.P
|
||||||
clean-logs
|
clean-logs
|
||||||
.RS
|
.RS
|
||||||
Cleans dependencies log tracking.
|
Cleans dependencies log tracking.
|
||||||
|
|
|
@ -6,14 +6,15 @@ import sys
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from slpkg.checks import Check
|
from slpkg.checks import Check
|
||||||
from slpkg.view_package import ViewPackage
|
|
||||||
from slpkg.upgrade import Upgrade
|
from slpkg.upgrade import Upgrade
|
||||||
from slpkg.version import Version
|
from slpkg.version import Version
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
from slpkg.utilities import Utilities
|
from slpkg.utilities import Utilities
|
||||||
|
from slpkg.search import SearchPackage
|
||||||
from slpkg.views.cli_menu import usage
|
from slpkg.views.cli_menu import usage
|
||||||
from slpkg.download_only import Download
|
from slpkg.download_only import Download
|
||||||
from slpkg.slackbuild import Slackbuilds
|
from slpkg.slackbuild import Slackbuilds
|
||||||
|
from slpkg.view_package import ViewPackage
|
||||||
from slpkg.find_installed import FindInstalled
|
from slpkg.find_installed import FindInstalled
|
||||||
from slpkg.remove_packages import RemovePackages
|
from slpkg.remove_packages import RemovePackages
|
||||||
from slpkg.clean_logs import CleanLogsDependencies
|
from slpkg.clean_logs import CleanLogsDependencies
|
||||||
|
@ -143,6 +144,18 @@ class Argparse:
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
usage(1)
|
usage(1)
|
||||||
|
|
||||||
|
def search(self):
|
||||||
|
if len(self.args) >= 2 and not self.flags:
|
||||||
|
packages = list(set(self.args[1:]))
|
||||||
|
packages = self.check.blacklist(packages)
|
||||||
|
|
||||||
|
# self.check.exists(packages)
|
||||||
|
|
||||||
|
search = SearchPackage()
|
||||||
|
search.package(packages)
|
||||||
|
raise SystemExit()
|
||||||
|
usage(1)
|
||||||
|
|
||||||
def find(self):
|
def find(self):
|
||||||
if len(self.args) >= 2 and not self.flags:
|
if len(self.args) >= 2 and not self.flags:
|
||||||
packages = list(set(self.args[1:]))
|
packages = list(set(self.args[1:]))
|
||||||
|
@ -195,6 +208,7 @@ def main():
|
||||||
'remove': argparse.remove,
|
'remove': argparse.remove,
|
||||||
'view': argparse.view,
|
'view': argparse.view,
|
||||||
'find': argparse.find,
|
'find': argparse.find,
|
||||||
|
'search': argparse.search,
|
||||||
'clean-logs': argparse.clean_logs,
|
'clean-logs': argparse.clean_logs,
|
||||||
'clean-tmp': argparse.clean_tmp
|
'clean-tmp': argparse.clean_tmp
|
||||||
}
|
}
|
||||||
|
|
20
slpkg/search.py
Normal file
20
slpkg/search.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
from slpkg.queries import SBoQueries
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class SearchPackage:
|
||||||
|
|
||||||
|
def package(self, packages):
|
||||||
|
names = SBoQueries('').names()
|
||||||
|
|
||||||
|
for name in names:
|
||||||
|
for package in packages:
|
||||||
|
if package in name:
|
||||||
|
print(f'{name}-{SBoQueries(name).version()} '
|
||||||
|
f'{SBoQueries(name).description()}')
|
|
@ -27,6 +27,7 @@ def usage(status: int):
|
||||||
f' {CYAN}remove{ENDC} <packages> Remove installed packages.',
|
f' {CYAN}remove{ENDC} <packages> Remove installed packages.',
|
||||||
f' {CYAN}find{ENDC} <packages> Find installed packages.',
|
f' {CYAN}find{ENDC} <packages> Find installed packages.',
|
||||||
f' {CYAN}view{ENDC} <packages> View packages from the repository.',
|
f' {CYAN}view{ENDC} <packages> View packages from the repository.',
|
||||||
|
f' {CYAN}search{ENDC} <packages> Search packages from the repository.',
|
||||||
f' {CYAN}clean-logs{ENDC} Clean dependencies log tracking.',
|
f' {CYAN}clean-logs{ENDC} Clean dependencies log tracking.',
|
||||||
f' {CYAN}clean-tmp{ENDC} Delete all the downloaded sources.\n',
|
f' {CYAN}clean-tmp{ENDC} Delete all the downloaded sources.\n',
|
||||||
f'{BOLD}OPTIONS:{ENDC}',
|
f'{BOLD}OPTIONS:{ENDC}',
|
||||||
|
|
Loading…
Add table
Reference in a new issue