X Tutup
Skip to content

Print repo and user context for status commands#278

Merged
vilmibm merged 5 commits intocli:masterfrom
vilmibm:pr-status-info
Jan 30, 2020
Merged

Print repo and user context for status commands#278
vilmibm merged 5 commits intocli:masterfrom
vilmibm:pr-status-info

Conversation

@vilmibm
Copy link
Copy Markdown
Contributor

@vilmibm vilmibm commented Jan 29, 2020

Closes #262

This PR adds another line at the top of gh {pr,issue} status commands. It informs the user what repo they're running the command in.

image
image

It's entirely possible that:

  • the username is overkill took this out as per ampinsk's suggestion
  • my colors don't make sense

Please note that in order to see the "(fork of owner/name)" indicator the parent repo's remote needs
not be named upstream or github; otherwise, we (intelligently) display status for the parent
repo and report accordingly. This will alert people that they are running status on a fork in the
event their remotes don't line up with what we expect.

I'm not thrilled with how I glommed the parentRepo field into the payloads but I was trying to
balance not making an extra request with not including more in the payloads than needed. I'm open to
suggestion there.

no longer displays whether repo is a fork

All of our other commands print enough context that I didn't think they needed updating.

@vilmibm vilmibm requested review from ampinsk and mislav January 29, 2020 21:48
@ampinsk
Copy link
Copy Markdown

ampinsk commented Jan 29, 2020

This is great thank you @vilmibm! ✨ To align more with the context we show for other commands, what I had in mind was something like:

Relevant pull requests for owner/repo

I agree the username feels like overkill here, and we're not showing it anywhere else right now. I actually think we don't necessarily need to show "(fork of x)" since I'd guess you can infer that from the repo name but very open for push back on that!

@vilmibm
Copy link
Copy Markdown
Contributor Author

vilmibm commented Jan 29, 2020

@ampinsk makes sense! i will retool for that.

@vilmibm
Copy link
Copy Markdown
Contributor Author

vilmibm commented Jan 29, 2020

@ampinsk reverted original version and replaced with simpler thing. body updated with new screenshots.

@ampinsk
Copy link
Copy Markdown

ampinsk commented Jan 30, 2020

Yay thank you! Just one more nit: Can we make it all white and include a line break before and after the context line? Basically so it matches the issues/pr list:

Screen Shot 2020-01-29 at 4 19 52 PM

command/issue.go Outdated
out := colorableOut(cmd)

fmt.Fprint(out, utils.Gray("Relevant issues in "))
fmt.Fprint(out, utils.Cyan(ghrepo.FullName(baseRepo)))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth noting that if the repository has been renamed, but the user still hasn't updated their git remotes, this will display the pre-rename repo.

If this becomes an issue (i.e. confusing) in the future, we can use something like resolveRemotesToRepos from pr create to find the "resolved" base repo—although, that adds an additional GraphQL query.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, my reverted commits glommed a repo look up onto the status commands in order to determine if the current repo was a fork. i took it out since ampinsk suggested less context was ok but it definitely showed there's only so much confidence we can have about what we're saying without a repo lookup per command. i think it'll be worth the initial performance penalty and once we do it it'll be more clear how best to cache it.

@vilmibm vilmibm merged commit 526714c into cli:master Jan 30, 2020
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.

Be explicit in pr status about what you are looking at

4 participants

X Tutup