Verified Commit 6beea961 authored by Adrian DC's avatar Adrian DC
Browse files

feat(entrypoint, gitlab): show GitLab username upon authentication

Signed-off-by: default avatarAdrian DC <radian.dc@gmail.com>
parent a4c1b0db
Loading
Loading
Loading
Loading
Loading
+1 −0
Changes for src/cli/entrypoint.py: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ class Entrypoint:
        )
        print(f'{Colors.BOLD} - GitLab host: '
              f'{Colors.GREEN}{gitlab.url}'
              f'{Colors.CYAN} ({gitlab.username})'
              f'{Colors.RESET}')
        Platform.flush()

+11 −4
Changes for src/features/gitlab.py: 11 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -948,6 +948,11 @@ class GitLabFeature:
        # Result
        return label

    # URL
    @property
    def url(self) -> str:
        return str(self.__gitlab.api_url)

    # User
    def user(
        self,
@@ -956,9 +961,11 @@ class GitLabFeature:
        users = self.__gitlab.users.list(all=True, iterator=True, username=criteria)
        for user in users:
            return cast(User, user)
        raise RuntimeError()
        raise RuntimeError(f'Could not find user {criteria}')

    # URL
    # User name
    @property
    def url(self) -> str:
        return str(self.__gitlab.api_url)
    def username(self) -> str:
        if self.__gitlab.user:
            return str(self.__gitlab.user.username)
        return '/'