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

When there is no slash in the argument, complement URL as $USER/repo #81

Merged
merged 1 commit into from
Aug 18, 2017

Conversation

babarot
Copy link
Contributor

@babarot babarot commented Jan 25, 2017

FEATURE REQUEST:

When the URL is most omitted, I want ghq(1) to regard it as $USER instead of repo

Now, completion as my-repo/my-repo

$ ghq get my-repo
     clone https://github.com/my-repo/my-repo -> /Users/b4b4r07/src/github.com/my-repo/my-repo
       git clone https://github.com/my-repo/my-repo /Users/b4b4r07/src/github.com/my-repo/my-repo
Cloning into '/Users/b4b4r07/src/github.com/my-repo/my-repo'...
remote: Repository not found.
fatal: repository 'https://github.com/my-repo/my-repo/' not found
     error /usr/local/bin/git: exit status 128

After merging this patch,

$ ./ghq get my-repo
     clone https://github.com/b4b4r07/my-repo -> /Users/b4b4r07/src/github.com/b4b4r07/my-repo
       git clone https://github.com/b4b4r07/my-repo /Users/b4b4r07/src/github.com/b4b4r07/my-repo
Cloning into '/Users/b4b4r07/src/github.com/b4b4r07/my-repo'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 3
Unpacking objects: 100% (3/3), done.

As a use case, it would be nice to be regarded as $USER! What do you think?

@syohex
Copy link
Contributor

syohex commented Jan 25, 2017

On Windows, user name environment variable is USERNAME, not USER.

@babarot
Copy link
Contributor Author

babarot commented Jan 25, 2017

Oh my bad, thanks. Ill fix that

@syohex
Copy link
Contributor

syohex commented Jan 26, 2017

I suppose it is better to add ghq.user(or ghq.github.user) git config variable other than USER and USERNAME environment variables too. Because username does not necessarily correspond to github account. For example, PC supplied by company.

@babarot
Copy link
Contributor Author

babarot commented Aug 9, 2017

@ALL ping

@motemen
Copy link
Member

motemen commented Aug 15, 2017

Thank you, I like this change.

Maybe looking for GITHUB_USER environment variable before falling back to USER would be nice, which is explicity named.

@babarot
Copy link
Contributor Author

babarot commented Aug 17, 2017

@motemen Thanks you for the suggestion, modified and squashed. Please review this change.

@motemen
Copy link
Member

motemen commented Aug 18, 2017

LGTM, thanks!

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

Successfully merging this pull request may close these issues.

3 participants