mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
Added: Ability to show only package name in list #57
This commit is contained in:
parent
794b2c36c7
commit
ce245f513f
5 changed files with 18 additions and 9 deletions
|
@ -434,7 +434,7 @@ Command Line Tool Usage
|
|||
Print, edit the configuration file
|
||||
or reset in the default values.
|
||||
-l | --list, [repository], --index, Print a list of all available
|
||||
--installed packages from repository, index or
|
||||
--installed, --name packages from repository, index or
|
||||
print only packages installed on
|
||||
the system.
|
||||
-c | --check, [repository], --upgrade, Check for updated packages from
|
||||
|
|
|
@ -38,7 +38,7 @@ Usage: slpkg [COMMANDS|OPTIONS] {repository|package...}
|
|||
[-q [package...] --add, --remove,
|
||||
[list, build, install, build-install]]
|
||||
[-g [print, edit, reset]]
|
||||
[-l [repository], --index, --installed]
|
||||
[-l [repository], --index, --installed, --name]
|
||||
[-c [repository], --upgrade, --skip=[...], --resolve-off,
|
||||
--checklist]
|
||||
[-s [repository] [package...], --resolve-off, --download-only,
|
||||
|
@ -189,7 +189,7 @@ Build or install or build and install packages are queued.
|
|||
Print, reset or edit configuration file.
|
||||
|
||||
.SS -l, --list, list of installed packages
|
||||
\fBslpkg\fP \fB-l\fP <\fIrepository\fP>, \fB--index\fP, \fB--installed\fP
|
||||
\fBslpkg\fP \fB-l\fP <\fIrepository\fP>, \fB--index\fP, \fB--installed\fP, \fB--name\fP
|
||||
.PP
|
||||
Print a list of all available packages from repository, index or print only packages installed on the
|
||||
system. Support command "grep" like "# slpkg -l sbo | grep python".
|
||||
|
|
|
@ -89,7 +89,7 @@ Optional arguments:
|
|||
Print, edit the configuration file
|
||||
or reset in the default values.
|
||||
-l | --list, [repository], --index, Print a list of all available
|
||||
--installed packages from repository, index or
|
||||
--installed, --name packages from repository, index or
|
||||
print only packages installed on
|
||||
the system.
|
||||
-c | --check, [repository], --upgrade, Check for updated packages from
|
||||
|
@ -163,7 +163,7 @@ def usage(repo):
|
|||
[-q [package...] --add, --remove,
|
||||
[list, build, install, build-install]]
|
||||
[-g [print, edit, reset]]
|
||||
[-l [repository], --index, --installed]
|
||||
[-l [repository], --index, --installedi, --name]
|
||||
[-c [repository], --upgrade, --skip=[...], --resolve-off,
|
||||
--checklist]
|
||||
[-s [repository] [package...], --resolve-off, --download-only,
|
||||
|
|
|
@ -243,22 +243,28 @@ class ArgParse(object):
|
|||
"-l",
|
||||
"--list"
|
||||
]
|
||||
flag = ["--index", "--installed"]
|
||||
flag = ["--index", "--installed", "--name"]
|
||||
name = False
|
||||
if "--name" in self.args:
|
||||
name = True
|
||||
self.args.remove("--name")
|
||||
if (len(self.args) == 3 and self.args[0] in options and
|
||||
self.args[1] in self.meta.repositories):
|
||||
if self.args[2] == flag[0]:
|
||||
PackageManager(binary=None).package_list(self.args[1],
|
||||
name,
|
||||
INDEX=True,
|
||||
installed=False)
|
||||
elif self.args[2] == flag[1]:
|
||||
PackageManager(binary=None).package_list(self.args[1],
|
||||
name,
|
||||
INDEX=False,
|
||||
installed=True)
|
||||
else:
|
||||
usage("")
|
||||
elif (len(self.args) == 2 and self.args[0] in options and
|
||||
self.args[1] in self.meta.repositories):
|
||||
PackageManager(None).package_list(self.args[1], INDEX=False,
|
||||
PackageManager(None).package_list(self.args[1], name, INDEX=False,
|
||||
installed=False)
|
||||
elif (len(self.args) > 1 and self.args[0] in options and
|
||||
self.args[1] not in self.meta.repositories):
|
||||
|
|
|
@ -437,7 +437,7 @@ class PackageManager(object):
|
|||
bol = eol = "\n"
|
||||
self.msg.pkg_not_found(bol, pkg, message, eol)
|
||||
|
||||
def package_list(self, repo, INDEX, installed):
|
||||
def package_list(self, repo, name, INDEX, installed):
|
||||
"""List with the installed packages
|
||||
"""
|
||||
tty_size = os.popen("stty size", "r").read().split()
|
||||
|
@ -450,6 +450,9 @@ class PackageManager(object):
|
|||
all_installed_names = self.list_of_installed(repo)
|
||||
print("")
|
||||
for pkg in sorted(pkg_list):
|
||||
package = pkg
|
||||
if name and repo != "sbo":
|
||||
pkg = split_package(pkg)[0]
|
||||
if INDEX:
|
||||
index += 1
|
||||
pkg = self.list_color_tag(pkg)
|
||||
|
@ -472,7 +475,7 @@ class PackageManager(object):
|
|||
pkg,
|
||||
self.meta.color["ENDC"]))
|
||||
else:
|
||||
if pkg[:-4] in all_installed_names:
|
||||
if package[:-4] in all_installed_names:
|
||||
print("{0}{1}{2}".format(self.meta.color["GREEN"],
|
||||
pkg,
|
||||
self.meta.color["ENDC"]))
|
||||
|
|
Loading…
Add table
Reference in a new issue