Skip to content

Show upstream icon? #5

@Nekketsu

Description

@Nekketsu

Would it be possible to add a property with the upstream URL?
If you consider that it might add undesired overload, it could be opted-in, i.e. passing a flag to the setup method to enable/disable the upstream resolution.

In tools like oh-my-posh we can see an upstream icon depending on where the remote repository is stored. In the following image we can see the GitHub icon:

Image

I seems that oh-my-posh gets it using the git command:

git remote get-url `upstream`

To get the upstream it calls git:

git remote

It uses origin as a default upstream in the case that the previous git command doesn't return a result.

It also adds the following parameters to all git commands:

"-C", g.repoRootDir, "--no-optional-locks", "-c", "core.quotepath=false", "-c", "color.status=false"

Having the stream URL we can use the fmt parameter to show whatever we want. In the case of oh-my-posh it shows the following icons (unicodes):

		"github":           {GithubIcon, "\uF408"},
		"gitlab":           {GitlabIcon, "\uF296"},
		"bitbucket":        {BitbucketIcon, "\uF171"},
		"dev.azure.com":    {AzureDevOpsIcon, "\uEBE8"},
		"visualstudio.com": {AzureDevOpsIcon, "\uEBE8"},
		"codecommit":       {CodeCommit, "\uF270"},
		"codeberg":         {CodebergIcon, "\uF330"},

But this last part could be part of the user configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions