From d5289fe9369621aae9ac33bbd102b400dda97414 Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Fri, 22 Jun 2018 10:28:39 +0200 Subject: [cli] Fix the non-verbose output of ProjectCommitComment Closes #433 --- gitlab/v4/cli.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gitlab/v4/cli.py') diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py index 451bec8..880b07d 100644 --- a/gitlab/v4/cli.py +++ b/gitlab/v4/cli.py @@ -326,7 +326,14 @@ class LegacyPrinter(object): print('%s: %s' % (obj._id_attr.replace('_', '-'), id)) if hasattr(obj, '_short_print_attr'): value = getattr(obj, obj._short_print_attr) - print('%s: %s' % (obj._short_print_attr, value)) + 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 = '%s: %s' % (obj._short_print_attr, value) + # ellipsize long lines (comments) + if len(line) > 79: + line = line[:76] + '...' + print(line) def display_list(self, data, fields, **kwargs): verbose = kwargs.get('verbose', False) -- cgit v1.2.1