Commit b31117b0 authored by Aurélien Dunand's avatar Aurélien Dunand Committed by Seblu

Update list command, display is_min_version and format

Signed-off-by: Seblu's avatarSébastien Luttringer <sebastien.luttringer@smartjog.com>
parent 22c90b6d
......@@ -339,7 +339,8 @@ def c_list(args):
repoman.show_images(args.pattern, o_long=args.long, o_json=args.json,
o_md5=args.md5, o_date=args.date, o_author=args.author,
o_size=args.size, o_url=args.url,
o_description=args.description)
o_description=args.description, o_format=args.format,
o_min_version=args.is_min_version)
def c_motd(args):
'''
......@@ -640,6 +641,10 @@ def arg_parser_init():
help="display image date")
p.add_argument("-D", "--description", action="store_true",
help="display image description")
p.add_argument("-f", "--format", action="store_true",
help="display image format")
p.add_argument("-i", "--is-min-version", action="store_true",
help="display minimum Installsystems version required")
p.add_argument("-j", "--json", action="store_true",
help="output is formated in json")
p.add_argument("-l", "--long", action="store_true",
......
......@@ -153,7 +153,7 @@ _is() {
(( args > 2 )) && _filedir
;;
list)
[[ "$cur" == -* ]] && _opt '-h --help -l --long -j --json -m --md5 -s --size -d --date -A --author -u --url -D --description' && return 0
[[ "$cur" == -* ]] && _opt '-h --help -l --long -j --json -m --md5 -s --size -d --date -A --author -u --url -D --description -f --format -i --is-min-version' && return 0
_remote_image
;;
motd)
......
......@@ -250,6 +250,8 @@ _is() {
'(-A --author)'{-A,--author}'[display image author]'
'(-d --date)'{-d,--date}'[display image date]'
'(-D --description)'{-D,--description}'[display image description]'
'(-f --format)'{-f,--format}'[display image format]'
'(-i --is-min-version)'{-i,--is-min-version}'[display minimum Installsystems version required]'
'(-j --json)'{-j,--json}'[output is formated in json]'
'(-l --long)'{-l,--long}'[long display]'
'(-m --md5)'{-m,--md5}'[display image md5]'
......
......@@ -227,7 +227,7 @@ install [--dry-run] <image>
do not execute setup scripts
list [-h] [-A] [-d] [-D] [-j] [-l] [-m] [-s] [-u] [<remote_image>...]
list [-h] [-A] [-d] [-D] [-f] [-j] [-i] [-l] [-m] [-s] [-u] [<remote_image>...]
List available *images*. By default, it displays the image name and its repository, ordered by repositories/images/version.
-A, --author
......@@ -239,9 +239,15 @@ list [-h] [-A] [-d] [-D] [-j] [-l] [-m] [-s] [-u] [<remote_image>...]
-D, --description
display image description
-f, --format
display image format
-j, --json
output is formated in json
-i, --is-min-version
display minimum Installsystems version required
-l, --long
long display
......
......@@ -418,10 +418,13 @@ class Repository(object):
'''
Return a dict of information on images
'''
db_images = self.db.ask("SELECT md5, name, version, date,\
author, description, size FROM image ORDER BY name, version").fetchall()
db_images = self.db.ask("SELECT md5, name, version, date, author, \
description, size, is_min_version, format \
FROM image ORDER BY name, version").fetchall()
images = []
field = ("md5", "name", "version", "date", "author", "description", "size")
field = ("md5", "name", "version", "date", "author", "description",
"size", "is_min_version", "format")
for info in db_images:
d = dict(zip(field, info))
d["repo"] = self.config.name
......@@ -934,8 +937,8 @@ class RepositoryManager(object):
self[repo].search(pattern)
def show_images(self, patterns, o_json=False, o_long=False, o_md5=False,
o_date=False, o_author=False, o_size=False,
o_url=False, o_description=False):
o_date=False, o_author=False, o_size=False, o_url=False,
o_description=False, o_format=False, o_min_version=False):
'''
Show images inside manager
'''
......@@ -962,6 +965,10 @@ class RepositoryManager(object):
l.append(u" #l#url:#R# %s" % img["url"])
if o_description or o_long:
l.append(u" #l#description:#R# %s" % img["description"])
if o_format or o_long:
l.append(u" #l#format:#R# %s" % img["format"])
if o_min_version or o_long:
l.append(u" #l#is min version:#R# %s" % img["is_min_version"])
s = os.linesep.join(l)
if len(s) > 0:
out(s)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment