Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git User #1362

Open
lobosan opened this issue Jun 14, 2023 · 8 comments
Open

Git User #1362

lobosan opened this issue Jun 14, 2023 · 8 comments
Labels
proposal An issue (rarely PR) for feature-requests, ideas, etc question Issue is a question, feedback, report or thanksgiving.

Comments

@lobosan
Copy link

lobosan commented Jun 14, 2023

The problem

I work with several github accounts and to me it is useful to display my github user in my prompt

Describe the solution you'd like

Show the github user before the current directory like this:
image
where lobosan is my github username

Describe alternatives you've considered

No response

Documentation and adoption

No response

@lobosan lobosan added the proposal An issue (rarely PR) for feature-requests, ideas, etc label Jun 14, 2023
@denysdovhan
Copy link
Member

Any suggestions how to get current active GitHub user? Are you using gh tool?

@lobosan
Copy link
Author

lobosan commented Jun 19, 2023

When using oh-my-zsh I use the avit theme, and display my git name by adding $(git config user.name) to the _user_host function
You can have a look at the whole theme here https://github.com/lobosan/zsh-theme/blob/main/avit.zsh-theme#LL16C1-L27C2
So, it would be great if you could add it to the spaceship configuration. In my case I'm installing it through fig, so it would be nice to see it under the git section
image

@denysdovhan
Copy link
Member

You are confusing git with github. It's not the same. Git is a VCS. GitHub is a hosting (website) for Git repos.

Yes, it's possible to display the result of git config user.name, though it's probably not the info you need to know when typing every other command. You probably need that once in a while, don't you?

@lobosan
Copy link
Author

lobosan commented Jun 19, 2023

Yes, I meant github user. This info is important to me when I'm in a folder that is a github repo, not on every command.

@denysdovhan
Copy link
Member

Again, git config user.name doesn't show your GitHub user. It shows you Git user.

@lobosan
Copy link
Author

lobosan commented Jun 19, 2023

you right sorry for the confusion, but is it possible to show my git user when working on a project with git?

@denysdovhan
Copy link
Member

Sure, you can do it yourselft. Here's a guide how to create a custom section: https://spaceship-prompt.sh/advanced/creating-section/#Typical-section-breakdown

You can create your custom git_user section. Istead of foobar --version you can run git config user.name.

@lobosan
Copy link
Author

lobosan commented Jun 19, 2023

thanks @denysdovhan

@denysdovhan denysdovhan changed the title Github User Git User Jun 19, 2023
@denysdovhan denysdovhan added the question Issue is a question, feedback, report or thanksgiving. label Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal An issue (rarely PR) for feature-requests, ideas, etc question Issue is a question, feedback, report or thanksgiving.
Development

No branches or pull requests

2 participants