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

Update repo command, display repository uuid and version (if online)

Signed-off-by: Seblu's avatarSébastien Luttringer <sebastien.luttringer@smartjog.com>
parent b31117b0
......@@ -430,7 +430,8 @@ def c_repo(args):
repoman.show_repositories(args.repository,
online=args.online, local=args.local,
o_url=args.url, o_state=args.state,
o_json=args.json)
o_uuid=args.uuid, o_json=args.json,
o_version=args.repo_version)
def c_search(args):
'''
......@@ -712,6 +713,10 @@ def arg_parser_init():
help="display repository state (online/offline/local/remote)")
p.add_argument("-u", "--url", action="store_true",
help="display repository url")
p.add_argument("-U", "--uuid", action="store_true",
help="display repository UUID")
p.add_argument("-v", "--version", dest="repo_version", action="store_true",
help="display repository version")
p.add_argument("--purge", action="store_true",
help="remove cache databases")
p.add_argument("repository", nargs='*', default=[u"*"], help="repository pattern")
......
......@@ -178,7 +178,7 @@ _is() {
_filedir -d
;;
repo)
[[ "$cur" == -* ]] && _opt '-h --help -l --local -r --remote -o --online -O --offline -s --state --force-offline --purge -u --url -j --json' && return 0
[[ "$cur" == -* ]] && _opt '-h --help -l --local -r --remote -o --online -O --offline -s --state --force-offline --purge -u --url -U --uuid -j --json -v --version' && return 0
_repo
;;
search)
......
......@@ -301,6 +301,8 @@ _is() {
'(-O --offline)'{-O,--offline}'[list offline repository (filter)]'
'(-s --state)'{-s,--state}'[display repository state (online/offline/local/remote)]'
'(-u --url)'{-u,--url}'[display repository url]'
'(-U --uuid)'{-U,--uuid}'[display repository UUID]'
'(-v --version)'{-v,--version}'[display repository version]'
'--purge[remove cache databases]'
'*:repo:_installsystems_repo'
)
......
......@@ -299,7 +299,7 @@ prepare_chroot [-h] [-m] *path*
disable mounting of /{proc,dev,sys}
repo [-h] [-j] [-l|-r] [-o|-O] [-s] [-u] [--purge] [repository]...
repo [-h] [-j] [-l|-r] [-o|-O] [-s] [-u] [-U] [-v] [--purge] [repository]...
List available repositories. By defaut, only names are displayed.
-j, --json
......@@ -323,6 +323,12 @@ repo [-h] [-j] [-l|-r] [-o|-O] [-s] [-u] [--purge] [repository]...
-u, --url
display repository url
-U, --uuid
display repository UUID
-v, --version
display repository version
--purge
remove cache databases
......
......@@ -1047,8 +1047,8 @@ class RepositoryManager(object):
else:
arrow("nothing to do", 1)
def show_repositories(self, patterns, local=None, online=None,
o_url=False, o_state=False, o_json=False):
def show_repositories(self, patterns, local=None, online=None, o_url=False,
o_state=False, o_uuid=False, o_json=False, o_version=False):
'''
Show repository inside manager
if :param online: is true, list only online repositories
......@@ -1072,6 +1072,9 @@ class RepositoryManager(object):
continue
repos[reponame] = dict(repo.config.items())
repos[reponame]["local"] = repo.local
if not repo.config.offline:
repos[reponame]["uuid"] = repo.uuid
repos[reponame]["version"] = repo.version
# display result
if o_json:
s = json.dumps(repos)
......@@ -1088,6 +1091,11 @@ class RepositoryManager(object):
ln += u"%s%s#R#"% (rc, name)
if o_url:
ln += u" (%s)" % repo["path"]
if not repo["offline"]:
if o_version:
ln += u" (#p#v%s#R#)" % repo["version"]
if o_uuid:
ln += u" [%s]" % repo["uuid"]
l.append(ln)
s = os.linesep.join(l)
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