node-gh / gh

(DEPRECATED) GitHub CLI made with NodeJS. Use the official https://cli.github.com/ instead.
http://nodegh.io
Other
1.71k stars 217 forks source link

repo --new should use the local repo's dirname by default #695

Closed zevaverbach closed 4 years ago

zevaverbach commented 4 years ago

Describe the solution you'd like repo --new --type private, for example, when executed in a local repo called repo, would create a new private repo with the name repo.

Would render #694 moot.

Would you accept a PR implementing this?

protoEvangelion commented 4 years ago

Hmm aren't we already doing that? https://github.com/node-gh/gh/blob/master/src/cmds/repo.ts#L541

zevaverbach commented 4 years ago

I'm afraid not! Just upgraded to 2.1.0 and did gh repo --new --type private. It created this repo, which is called --type and is public.

protoEvangelion commented 4 years ago

Does this work for you? gh re --new foo --init --type private

zevaverbach commented 4 years ago

The --init isn't required, and yes, that does work, but it doesn't resolve this issue (naming the repo according to the root dir name).

protoEvangelion commented 4 years ago

I see. So it sounds like we are forcing whatever comes after --new to be the repo name. What you want to do makes sense then.

Go for it and please let me know how I can help 👍

zevaverbach commented 4 years ago

👍 Will do. Any thoughts on doing #696 simultaneously?

protoEvangelion commented 4 years ago

I'm fine with it being one PR unless you prefer to do it in 2 :)

zevaverbach commented 4 years ago

@protoEvangelion changed your mind about this or...?

protoEvangelion commented 4 years ago

Sorry about that...this is getting auto closed by some script I have 😑

protoEvangelion commented 4 years ago

Occupational hazard of testing this repo since it hits real apis 😬

protoEvangelion commented 4 years ago

@zevaverbach I've been thinking about this some more and it seems to be fundamentally a parser issue.

Our parser (nopt) isn't "smart" in that if you pass two flags one right after the other --foo --bar the parsed options will be { foo: '--bar'}.

I've been wanting to change option parsers for a while now, but you may to get around this by checking if the value in new is a known flag. If it is, we can fallback to the local dir's name.

protoEvangelion commented 4 years ago

Doing some further research, it looks like nopt resolved this exact issue in it's latest version v4:

image

The version we are using:

image

Updating, could be the proper resolution to this ;)

protoEvangelion commented 4 years ago

@zevaverbach did you have something in the works already?

zevaverbach commented 4 years ago

Not yet, sorry!

On Wed, Nov 6, 2019 at 5:44 PM Ryan Garant notifications@github.com wrote:

@zevaverbach https://github.com/zevaverbach did you have something in the works already?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/node-gh/gh/issues/695?email_source=notifications&email_token=AAVVCNEXNE4U7DFYZKTW5LDQSLX75A5CNFSM4I5MAFQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDHGERY#issuecomment-550396487, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVVCNBEZ6ZLLQMIFEFUBFLQSLX75ANCNFSM4I5MAFQQ .

protoEvangelion commented 4 years ago

That's OK. I will update nopt to see if that fixes the issue 👍

protoEvangelion commented 4 years ago

:tada: This issue has been resolved in version 2.6.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: