diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2018-06-22 10:28:39 +0200 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2018-06-22 10:28:39 +0200 |
commit | d5289fe9369621aae9ac33bbd102b400dda97414 (patch) | |
tree | e100901a393e55874ec69c94fb056b7cf0d697fd /gitlab/v4/cli.py | |
parent | b1c63927aaa7c753fa622af5ac3637102ba9aea3 (diff) | |
download | gitlab-d5289fe9369621aae9ac33bbd102b400dda97414.tar.gz |
[cli] Fix the non-verbose output of ProjectCommitComment
Closes #433
Diffstat (limited to 'gitlab/v4/cli.py')
-rw-r--r-- | gitlab/v4/cli.py | 9 |
1 files changed, 8 insertions, 1 deletions
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) |