本文整理匯總了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)
}
}