From 6b47c26d053fe352d68eb22a1eaf4b9a3c1c93e7 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Sat, 7 May 2022 22:50:11 +0200 Subject: feat: display human-readable attribute in `repr()` if present --- gitlab/v4/cli.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gitlab/v4/cli.py') 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]}..." -- cgit v1.2.1