summaryrefslogtreecommitdiff
path: root/gitlab/v4/cli.py
diff options
context:
space:
mode:
authorNejc Habjan <nejc.habjan@siemens.com>2022-05-07 22:50:11 +0200
committerJohn Villalovos <john@sodarock.com>2022-05-08 09:47:13 -0700
commit6b47c26d053fe352d68eb22a1eaf4b9a3c1c93e7 (patch)
tree4728804ac977fa74888beb47ef8759c7744d9a55 /gitlab/v4/cli.py
parent2373a4f13ee4e5279a424416cdf46782a5627067 (diff)
downloadgitlab-6b47c26d053fe352d68eb22a1eaf4b9a3c1c93e7.tar.gz
feat: display human-readable attribute in `repr()` if present
Diffstat (limited to 'gitlab/v4/cli.py')
-rw-r--r--gitlab/v4/cli.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py
index 6830b08..245897e 100644
--- a/gitlab/v4/cli.py
+++ b/gitlab/v4/cli.py
@@ -449,12 +449,12 @@ class LegacyPrinter:
if obj._id_attr:
id = getattr(obj, obj._id_attr)
print(f"{obj._id_attr.replace('_', '-')}: {id}")
- if obj._short_print_attr:
- value = getattr(obj, obj._short_print_attr) or "None"
+ if obj._repr_attr:
+ value = getattr(obj, obj._repr_attr, "None")
value = value.replace("\r", "").replace("\n", " ")
# If the attribute is a note (ProjectCommitComment) then we do
# some modifications to fit everything on one line
- line = f"{obj._short_print_attr}: {value}"
+ line = f"{obj._repr_attr}: {value}"
# ellipsize long lines (comments)
if len(line) > 79:
line = f"{line[:76]}..."