Golang github.Project類代碼示例- 純淨天空

文章推薦指數: 80 %
投票人數:10人

本文整理匯總了Golang中github.com/jingweno/gh/github.Project類的典型用法代碼示例。

如果您正苦於以下問題:Golang Project類的具體用法?Golang Project怎麽用? 當前位置:首頁>>代碼示例>>Golang>>正文 本文整理匯總了Golang中github.com/jingweno/gh/github.Project類的典型用法代碼示例。

如果您正苦於以下問題:GolangProject類的具體用法?GolangProject怎麽用?GolangProject使用的例子?那麽恭喜您,這裏精選的類代碼示例或許可以為您提供幫助。

在下文中一共展示了Project類的6個代碼示例,這些例子默認根據受歡迎程度排序。

您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Golang代碼示例。

示例1:transformRemoteArgs ​點讚7 ​ functransformRemoteArgs(args*Args){ ownerWithName:=args.LastParam() owner,name,match:=parseRepoNameOwner(ownerWithName) if!match{ return } varerrerror ifname==""{ name,err=utils.DirName() utils.Check(err) } isPriavte:=parseRemotePrivateFlag(args) ifowner=="origin"{ owner=github.CurrentConfig().FetchUser() }elseifargs.ParamsSize()>2{ //`gitremoteaddjingwenofoo/bar` args.RemoveParam(args.ParamsSize()-1) } project:=github.Project{Owner:owner,Name:name} url:=project.GitURL(name,owner,isPriavte) args.AppendParams(url) }開發者ID:johnbellone,項目名稱:gh,代碼行數:27,代碼來源:remote.go 示例2:transformCloneArgs ​點讚6 ​ functransformCloneArgs(args*Args){ isSSH:=parseClonePrivateFlag(args) hasValueRegxp:=regexp.MustCompile("^(--(upload-pack|template|depth|origin|branch|reference|name)|-[ubo])$") nameWithOwnerRegexp:=regexp.MustCompile(NameWithOwnerRe) fori,a:=rangeargs.Params{ ifhasValueRegxp.MatchString(a){ continue } ifnameWithOwnerRegexp.MatchString(a)&&!isDir(a){ name,owner:=parseCloneNameAndOwner(a) config:=github.CurrentConfig() isSSH=isSSH||owner==config.User ifowner==""{ owner=config.User } project:=github.Project{Name:name,Owner:owner} url:=project.GitURL(name,owner,isSSH) args.ReplaceParam(i,url) break } } }開發者ID:rif,項目名稱:golang-stuff,代碼行數:25,代碼來源:clone.go 示例3:browse ​點讚4 ​ /* $ghbrowse >openhttps://github.com/YOUR_USER/CURRENT_REPO $ghbrowsecommit/SHA >openhttps://github.com/YOUR_USER/CURRENT_REPO/commit/SHA $ghbrowseissues >openhttps://github.com/YOUR_USER/CURRENT_REPO/issues $ghbrowse-pjingweno/gh >openhttps://github.com/jingweno/gh $ghbrowse-pjingweno/ghcommit/SHA >openhttps://github.com/jingweno/gh/commit/SHA $ghbrowse-presque >openhttps://github.com/YOUR_USER/resque $ghbrowse-presquenetwork >openhttps://github.com/YOUR_USER/resque/network */ funcbrowse(command*Command,args*Args){ var( project*github.Project branch*github.Branch errerror ) localRepo:=github.LocalRepo() ifflagBrowseProject!=""{ //ghbrowse-pjingweno/gh //ghbrowse-pgh project=github.NewProject("",flagBrowseProject,"") }else{ //ghbrowse branch,project,err=localRepo.RemoteBranchAndProject("") utils.Check(err) } ifproject==nil{ err:=fmt.Errorf(command.FormattedUsage()) utils.Check(err) } master:=localRepo.MasterBranch() ifbranch==nil{ branch=master } varsubpagestring if!args.IsParamsEmpty(){ subpage=args.RemoveParam(0) } ifsubpage=="commits"{ subpage=fmt.Sprintf("commits/%s",branchInURL(branch)) }elseifsubpage=="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) ifflagBrowseURLOnly{ args.Replace("echo",pageUrl) }else{ args.Replace(launcher[0],"",launcher[1:]...) args.AppendParams(pageUrl) } }開發者ID:jingweno,項目名稱:gh,代碼行數:73,代碼來源:browse.go 示例4:transformInitArgs ​點讚1 ​ functransformInitArgs(args*Args)error{ if!parseInitFlag(args){ returnnil } name,err:=utils.DirName() iferr!=nil{ returnerr } owner:=github.CurrentConfig().FetchUser() project:=github.Project{Owner:owner,Name:name} url:=project.GitURL(name,owner,true) args.After("git","remote","add","origin",url) returnnil }開發者ID:rif,項目名稱:golang-stuff,代碼行數:17,代碼來源:init.go 示例5:compare ​點讚1 ​ /* $ghcomparerefactor >openhttps://github.com/CURRENT_REPO/compare/refactor $ghcompare1.0..1.1 >openhttps://github.com/CURRENT_REPO/compare/1.0...1.1 $ghcompare-uother-userpatch >openhttps://github.com/other-user/REPO/compare/patch */ funccompare(command*Command,args*Args){ localRepo:=github.LocalRepo() var( branch*github.Branch project*github.Project rstring errerror ) branch,project,err=localRepo.RemoteBranchAndProject("") utils.Check(err) ifargs.IsParamsEmpty(){ master:=localRepo.MasterBranch() ifmaster.ShortName()==branch.ShortName(){ err=fmt.Errorf(command.FormattedUsage()) utils.Check(err) }else{ r=branch.ShortName() } }else{ r=parseCompareRange(args.RemoveParam(args.ParamsSize()-1)) ifargs.IsParamsEmpty(){ project,err=localRepo.CurrentProject() utils.Check(err) }else{ project=github.NewProject(args.RemoveParam(args.ParamsSize()-1),"","") } } r=strings.Replace(r,"/",";",-1) subpage:=utils.ConcatPaths("compare",r) url:=project.WebURL("","",subpage) launcher,err:=utils.BrowserLauncher() utils.Check(err) ifflagCompareURLOnly{ args.Replace("echo",url) }else{ args.Replace(launcher[0],"",launcher[1:]...) args.AppendParams(url) } }開發者ID:jonmorehouse,項目名稱:gh,代碼行數:53,代碼來源:compare.go 示例6:transformCloneArgs ​點讚1 ​ functransformCloneArgs(args*Args){ isSSH:=parseClonePrivateFlag(args) hasValueRegxp:=regexp.MustCompile("^(--(upload-pack|template|depth|origin|branch|reference|name)|-[ubo])$") nameWithOwnerRegexp:=regexp.MustCompile(NameWithOwnerRe) varskipNextbool fori,a:=rangeargs.Params{ ifskipNext{ skipNext=false continue } ifstrings.HasPrefix(a,"-"){ ifhasValueRegxp.MatchString(a){ skipNext=true } continue } ifgithub.MatchURL(a)!=nil{ break } ifnameWithOwnerRegexp.MatchString(a)&&!isDir(a){ name,owner:=parseCloneNameAndOwner(a) config:=github.CurrentConfig() isSSH=isSSH||args.Command!="submodule"&&owner==config.User ifowner==""{ owner=config.User isSSH=true } project:=github.Project{Name:name,Owner:owner} url:=project.GitURL(name,owner,isSSH) args.ReplaceParam(i,url) break } } }開發者ID:johnbellone,項目名稱:gh,代碼行數:39,代碼來源:clone.go 注:本文中的github.com/jingweno/gh/github.Project類示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。

相關方法 Project.GitURL Project.WebURL



請為這篇文章評分?