mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +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 unused configurations
|
||||
- Search command to view
|
||||
Added:
|
||||
- A new search command to search and match packages from the repository
|
||||
|
||||
4.2.1 - 18/10/2022
|
||||
Added:
|
||||
|
|
|
@ -56,6 +56,7 @@ Usage
|
|||
remove <packages> Remove installed packages.
|
||||
find <packages> Find installed packages.
|
||||
view <packages> View packages from the repository.
|
||||
search <packages> Search packages from the repository.
|
||||
clean-logs Clean dependencies log tracking.
|
||||
clean-tmp Deletes all the downloaded sources.
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
slpkg - [OPTIONS] [COMMAND] <packages>
|
||||
.SH SYNAPSES
|
||||
.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
|
||||
.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.
|
||||
|
@ -52,6 +52,11 @@ view
|
|||
View packages from the repository and get everything in your terminal.
|
||||
.RE
|
||||
.P
|
||||
search
|
||||
.RS
|
||||
Search and match packages from the repository.
|
||||
.RE
|
||||
.P
|
||||
clean-logs
|
||||
.RS
|
||||
Cleans dependencies log tracking.
|
||||
|
|
|
@ -6,14 +6,15 @@ import sys
|
|||
from dataclasses import dataclass
|
||||
|
||||
from slpkg.checks import Check
|
||||
from slpkg.view_package import ViewPackage
|
||||
from slpkg.upgrade import Upgrade
|
||||
from slpkg.version import Version
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.search import SearchPackage
|
||||
from slpkg.views.cli_menu import usage
|
||||
from slpkg.download_only import Download
|
||||
from slpkg.slackbuild import Slackbuilds
|
||||
from slpkg.view_package import ViewPackage
|
||||
from slpkg.find_installed import FindInstalled
|
||||
from slpkg.remove_packages import RemovePackages
|
||||
from slpkg.clean_logs import CleanLogsDependencies
|
||||
|
@ -143,6 +144,18 @@ class Argparse:
|
|||
raise SystemExit()
|
||||
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):
|
||||
if len(self.args) >= 2 and not self.flags:
|
||||
packages = list(set(self.args[1:]))
|
||||
|
@ -195,6 +208,7 @@ def main():
|
|||
'remove': argparse.remove,
|
||||
'view': argparse.view,
|
||||
'find': argparse.find,
|
||||
'search': argparse.search,
|
||||
'clean-logs': argparse.clean_logs,
|
||||
'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}find{ENDC} <packages> Find installed packages.',
|
||||
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-tmp{ENDC} Delete all the downloaded sources.\n',
|
||||
f'{BOLD}OPTIONS:{ENDC}',
|
||||
|
|
Loading…
Reference in a new issue