Skip to content

Commit 41b6dba

Browse files
author
Gauvain Pocentek
committed
pretty_print: use - instead of _
1 parent 7175772 commit 41b6dba

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

gitlab.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -488,21 +488,22 @@ def __str__(self):
488488

489489
def pretty_print(self, depth=0):
490490
id = self.__dict__[self.idAttr]
491-
print("%sid: %s" % (" " * depth * 2, id))
491+
print("%s%s: %s" % (" " * depth * 2, self.idAttr, id))
492492
for k in sorted(self.__dict__.keys()):
493-
if k == "id":
493+
if k == self.idAttr:
494494
continue
495495
v = self.__dict__[k]
496+
pretty_k = k.replace('_', '-')
496497
if isinstance(v, GitlabObject):
497498
if depth == 0:
498-
print("%s:" % k)
499+
print("%s:" % pretty_k)
499500
v.pretty_print(1)
500501
else:
501-
print("%s: %s" % (k, v.id))
502+
print("%s: %s" % (pretty_k, v.id))
502503
else:
503504
if isinstance(v, Gitlab):
504505
continue
505-
print("%s%s: %s" % (" " * depth * 2, k, v))
506+
print("%s%s: %s" % (" " * depth * 2, pretty_k, v))
506507

507508
def json(self):
508509
return json.dumps(self.__dict__, cls=jsonEncoder)

0 commit comments

Comments
 (0)