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

Add user command #992

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add user command #992

wants to merge 1 commit into from

Conversation

sbp
Copy link

@sbp sbp commented Sep 9, 2015

This new command writes the default user from hub config to stdout with a
trailing newline. For example, if you are me you get:

$ hub user
sbp

This is useful for automating contribution scripts. Say, for example, that you
want to write a script that pushes your contributions to some feature branch.
Using this command, you can do:

$ hub push `hub user` `git rev-parse --abbrev-ref HEAD`

Whereas otherwise you would have to manually fill in the user name, even though
hub knows what user name it would normally use from config.

@mislav
Copy link
Owner

mislav commented Sep 26, 2015

Thanks, this looks good!

  1. I would like that the command is called something more specific, like whoami, in case we want to add a user command in the future that looks up other users or whatnot.
  2. This needs tests. Specifically, I would like to see some cukes created in features/whoami.feature; one that verifies that your username is displayed when proper configuration is in place, and one with the command failure in case there is no configuration (i.e. the user hasn't yet authenticated). Look at other cukes to get a feeling of how to write them.

@mislav mislav added the feature label Sep 26, 2015
@mislav
Copy link
Owner

mislav commented Jan 22, 2016

This functionality is related to #225.

@dechowdev
Copy link

Hmmm how about the command was hub account ? :)

@sbp
Copy link
Author

sbp commented Oct 5, 2017

@timofonic This kinda bifurcated #225 where @mislav had already written in July 2015:

I think we want the command to be called hub auth and have several subcomands, like login, whoami and possibly config to see per-host hub configuration.

I hadn't seen that at the time I made this PR (#992). Writing all of hub auth plus associated tests is not something that I planned or plan to do.

I originally wrote this PR because I think contributing back to github projects using the web based PR mechanism is a lot more difficult than it needs to be. For some of my projects I want people contributing to them as much as possible, and so I started to explore anything that I could do to encourage that. A command line option seemed like a pretty good encouragement, because I could just make a script that does everything for you—it could build a local copy of hub, prompt for your username, and then automatically push your changes. You could clone my code, make your changes, check it in, and then simply run a script in the repo in order to contribute back!

When this pull request was not accepted, I lost interest, and to be honest I haven't even used hub myself since then even though I'm a pretty active github user. It's entirely reasonable for the hub maintainers to want a nice, unified API and extensive tests for this feature, and I hope that eventually they land in hub.

@kandice1978
Copy link

Um

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants