Skip to content

Add repo view command#337

Merged
vilmibm merged 7 commits intocli:masterfrom
spenrose:repo-view
Feb 24, 2020
Merged

Add repo view command#337
vilmibm merged 7 commits intocli:masterfrom
spenrose:repo-view

Conversation

@spenrose
Copy link
Copy Markdown
Contributor

@spenrose spenrose commented Feb 9, 2020

Adds support gh repo view discussed in #307. It supports no args to open current repo currently in, owner/repo and full url.

$ gh repo
Work with GitHub repositories.

A repository can be supplied as an argument in any of the following formats:
- by owner/repo, e.g. "cli/cli"
- by URL, e.g. "https://github.com/cli/cli"

Usage:
  gh repo [command]

Available Commands:
  view        View a repository in the browser

I wasn't sure how much validation I should do around owner/repo or URL. Any advice here is greatly welcomed.

ps. this is my first time working in go. looking for as much feedback as possible. thanks

Copy link
Copy Markdown
Contributor

@vilmibm vilmibm left a comment

Choose a reason for hiding this comment

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

thanks for this! Just the one comment about baserepo, otherwise 👍 . Thanks for including tests!

command/repo.go Outdated

func repoView(cmd *cobra.Command, args []string) error {
ctx := contextForCommand(cmd)
baseRepo, err := ctx.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.

I think for consistency this should use the new determineBaseRepo helper

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.

Sounds great, updated.

```
$ gh repo
Work with GitHub repositories.

A repository can be supplied as an argument in any of the following formats:
- by owner/repo, e.g. "cli/cli"
- by URL, e.g. "https://github.com/cli/cli"

Usage:
  gh repo [command]

Available Commands:
  view        View a repository in the browser
```
@spenrose
Copy link
Copy Markdown
Contributor Author

@vilmibm This should be good to go now.

@hmemcpy
Copy link
Copy Markdown

hmemcpy commented Feb 24, 2020

Is it possible to alias this to browse? I've used hub browse so often, my muscle memory hurts :)

@mislav
Copy link
Copy Markdown
Contributor

mislav commented Feb 24, 2020

@hmemcpy #294

Copy link
Copy Markdown
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

Thank you! Added a few tweaks, but otherwise looked great.

@mislav mislav requested a review from vilmibm February 24, 2020 19:16
Copy link
Copy Markdown
Contributor

@vilmibm vilmibm left a comment

Choose a reason for hiding this comment

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

This needs support for viewing a repo in the command line (like --preview for other things); but since we're discussing making that the default (and switching to --web) that can be follow-up work.

@vilmibm vilmibm merged commit 7a222d8 into cli:master Feb 24, 2020
@spenrose spenrose deleted the repo-view branch February 25, 2020 00:06
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.

5 participants