Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sjrpc
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
sjrpc
Commits
bcdb297d
Commit
bcdb297d
authored
14 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
list -l and list -t use new objects convention
parent
de4072b0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cccli/command/list.py
+24
-21
24 additions, 21 deletions
cccli/command/list.py
with
24 additions
and
21 deletions
cccli/command/list.py
+
24
−
21
View file @
bcdb297d
...
...
@@ -41,37 +41,40 @@ class Command_list(TqlCommand):
'''
Listing line aligned
'''
# get max size by tag
tags
=
dict
()
for
o
in
objs
:
for
(
t
,
v
)
in
o
:
for
o
in
objs
[
"
objects
"
]
:
for
(
t
,
v
)
in
o
.
items
()
:
tags
[
t
]
=
max
(
len
(
self
.
tdr
(
t
,
v
)),
tags
.
get
(
t
,
len
(
t
)))
# build initial print order
order
=
[
t
for
t
in
objs
.
get
(
"
order
"
,
[])
if
t
in
tags
]
order
.
extend
(
sorted
(
set
(
tags
.
keys
())
-
set
(
order
)))
# dislay each object by line
for
o
in
objs
:
# show others tags
line
=
str
()
for
(
tagname
,
tagvalue
)
in
o
:
line
+=
"
%s%s:%s%s
"
%
(
self
.
tdtc
(
tagname
),
tagname
,
self
.
tdc
(
tagname
),
self
.
tdr
(
tagname
,
tagvalue
).
ljust
(
tags
[
tagname
]
+
1
))
for
o
in
objs
[
"
objects
"
]:
line
=
""
for
t
in
order
:
line
+=
"
%s%s:%s%s
"
%
(
self
.
tdtc
(
t
),
t
,
self
.
tdc
(
t
),
self
.
tdr
(
t
,
o
.
get
(
t
,
""
)).
ljust
(
tags
[
t
]))
self
.
printer
.
out
(
"
%s%s
"
%
(
line
,
color
[
"
reset
"
]))
def
list_table
(
self
,
objs
):
'''
Listing table style
'''
# get max size by tag
tags
=
dict
()
for
o
in
objs
:
for
(
t
,
v
)
in
o
:
for
o
in
objs
[
"
objects
"
]
:
for
(
t
,
v
)
in
o
.
items
()
:
tags
[
t
]
=
max
(
len
(
self
.
tdr
(
t
,
v
)),
tags
.
get
(
t
,
len
(
t
)))
# print title
for
t
,
v
in
tags
.
items
():
# build initial print order
order
=
[
t
for
t
in
objs
.
get
(
"
order
"
,
[])
if
t
in
tags
]
order
.
extend
(
sorted
(
set
(
tags
.
keys
())
-
set
(
order
)))
# print tag title in order
for
t
in
order
:
self
.
printer
.
out
(
self
.
tdtc
(
t
),
nl
=
""
)
self
.
printer
.
out
(
t
.
ljust
(
v
),
nl
=
"
"
)
self
.
printer
.
out
(
t
.
ljust
(
tags
[
t
]
),
nl
=
"
"
)
self
.
printer
.
out
(
color
[
"
reset
"
])
# print obj
for
obj
in
objs
:
obj
=
dict
(
obj
)
# print others tags
for
(
t
,
v
)
in
tags
.
items
():
# print tags in order
for
o
in
objs
[
"
objects
"
]:
for
t
in
order
:
self
.
printer
.
out
(
self
.
tdc
(
t
),
nl
=
""
)
self
.
printer
.
out
(
self
.
tdr
(
t
,
o
bj
.
get
(
t
,
u
""
)).
ljust
(
v
)
,
nl
=
"
"
)
self
.
printer
.
out
(
self
.
tdr
(
t
,
o
.
get
(
t
,
u
""
)).
ljust
(
tags
[
t
]
)
,
nl
=
"
"
)
self
.
printer
.
out
(
color
[
"
reset
"
])
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment