本文整理汇总了Golang中github.com/jingweno/gh/github.Branch.IsRemote方法的典型用法代码示例。如果您正苦于以下问题:Golang Branch.IsRemote方法的具体用法?Golang Branch.IsRemote怎么用?Golang Branch.IsRemote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jingweno/gh/github.Branch
的用法示例。
在下文中一共展示了Branch.IsRemote方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: browse
/*
$ gh browse
> open https://github.com/YOUR_USER/CURRENT_REPO
$ gh browse commit/SHA
> open https://github.com/YOUR_USER/CURRENT_REPO/commit/SHA
$ gh browse issues
> open https://github.com/YOUR_USER/CURRENT_REPO/issues
$ gh browse -p jingweno/gh
> open https://github.com/jingweno/gh
$ gh browse -p jingweno/gh commit/SHA
> open https://github.com/jingweno/gh/commit/SHA
$ gh browse -p resque
> open https://github.com/YOUR_USER/resque
$ gh browse -p resque network
> open https://github.com/YOUR_USER/resque/network
*/
func browse(command *Command, args *Args) {
var (
project *github.Project
branch *github.Branch
err error
)
localRepo := github.LocalRepo()
if flagBrowseProject != "" {
// gh browse -p jingweno/gh
// gh browse -p gh
project = github.NewProject("", flagBrowseProject, "")
} else {
// gh browse
branch, project, err = localRepo.RemoteBranchAndProject("")
utils.Check(err)
}
if project == nil {
err := fmt.Errorf(command.FormattedUsage())
utils.Check(err)
}
master := localRepo.MasterBranch()
if branch == nil {
branch = master
}
var subpage string
if !args.IsParamsEmpty() {
subpage = args.RemoveParam(0)
}
if subpage == "commits" {
subpage = fmt.Sprintf("commits/%s", branchInURL(branch))
} else if subpage == "tree" || subpage == "" {
if !reflect.DeepEqual(branch, master) && branch.IsRemote() {
subpage = fmt.Sprintf("tree/%s", branchInURL(branch))
}
}
pageUrl := project.WebURL("", "", subpage)
launcher, err := utils.BrowserLauncher()
utils.Check(err)
if flagBrowseURLOnly {
args.Replace("echo", pageUrl)
} else {
args.Replace(launcher[0], "", launcher[1:]...)
args.AppendParams(pageUrl)
}
}