[client.equo/client.text_query] implement new query command

Implement new equo query command for listing repository packages
$ equo query list available <repository>
This commit is contained in:
Fabio Erculiani
2009-06-18 15:42:16 +02:00
parent 3181a35360
commit 371b3f8041
2 changed files with 18 additions and 6 deletions

View File

@@ -182,7 +182,8 @@ myopts = [
(2,'installed',1,_('search a package into the local database')),
(2,'license',2,_('show packages owning the provided licenses')),
(2,'list',2,_('list packages based on the chosen parameter below')),
(3,'installed',1,_('list installed packages')),
(3,'installed',2,_('list installed packages')),
(3,'available [repos]',1,_('list available packages')),
(2,'needed',2,_('show runtime libraries needed by the provided atoms')),
(2,'orphans',2,_('search files that do not belong to any package')),
(2,'removal',2,_('show the removal tree for the specified atoms')),
@@ -401,16 +402,17 @@ options = _options
# 'equo help' support
if options:
if options[0] == "help":
options[0] = "--help"
options.insert(0,"--help")
# print help
if (not options) or ("--help" in options):
print_menu(myopts)
if etpUi['verbose']:
print_menu(myopts_extended)
else:
print_menu(myopts_ext_info)
if not options:
print_error("not enough parameters")
if etpUi['verbose'] or len(options) > 1:
print_menu(myopts + myopts_extended, options)
else:
print_menu(myopts + myopts_ext_info)
raise SystemExit(1)
# sure we don't need this after
del myopts

View File

@@ -96,6 +96,16 @@ def query(options):
if len(mylistopts) > 0:
if mylistopts[0] == "installed":
rc_status = list_installed_packages()
elif mylistopts[0] == "available" and len(mylistopts) > 1:
repoid = mylistopts[1]
equo = EquoInterface()
if repoid in equo.validRepositories:
repo_dbconn = equo.open_repository(repoid)
rc_status = list_installed_packages(dbconn = repo_dbconn)
else:
rc_status = -10
else:
rc_status = -10
elif myopts[0] == "description":
rc_status = search_description(myopts[1:])
else: