ruby – 使用Octokit.rb输出回购URL
发布时间:2020-12-16 22:55:02 所属栏目:百科 来源:网络整理
导读:我正在尝试使用 Octokit.rb列出Github帐户存储库的详细信息,但似乎无法找到关联的URL. 在第一个实例中,我需要做的就是使用OAuth对Github API进行身份验证,并将详细信息输出到控制台.到目前为止,这是一个基本的例子: client = Octokit::Client.new :access_t
我正在尝试使用
Octokit.rb列出Github帐户存储库的详细信息,但似乎无法找到关联的URL.
在第一个实例中,我需要做的就是使用OAuth对Github API进行身份验证,并将详细信息输出到控制台.到目前为止,这是一个基本的例子: client = Octokit::Client.new :access_token => 'my_token' client.repos.each do |repo| puts repo.name puts repo.description # html_url & clone_url go here. end 我确定我忽略了一些显而易见的事情,但你需要做些什么才能找到每个存储库的html_url,clone_url等(根据API)? 解决方法
事实证明,这显然是显而易见的:
client = Octokit::Client.new :access_token => 'my_token' client.repos.each do |repo| puts repo.name puts repo.description # find the urls puts repo.rels[:html].href puts repo.rels[:git].href puts repo.rels[:clone].href puts repo.rels[:ssh].href end (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
热点阅读