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

Heuristically guess username from gh auth status #3

Merged
merged 2 commits into from
Dec 29, 2022
Merged

Conversation

norwd
Copy link
Contributor

@norwd norwd commented Nov 28, 2022

This closes #2 by running gh auth status and parsing its output for a username.

The output of gh auth status prints a little summary of the current gh session, including the GitHub username:

image

I've tested this using the latest version on gh on a Linux box, so I don't know how this will behave on MacOS or Windows for example, but I've designed it to simply fall back to the old behaviour of expecting an explicit argument if it can't find anything that looks like a username, so it fails gracefully.

@rsese
Copy link
Owner

rsese commented Dec 29, 2022

Thanks! Seems like a nice default -- I gave this a try and it works for me on macOS.

@rsese rsese merged commit 5f5eb03 into rsese:trunk Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to infer github organisation or user name
2 participants