def view_url(self, url):
"""View the given url.
:type index: int
:param index: The index for the given item, used with the
gh view [index] commend.
:type url: str
:param url: The url to view
"""
contents = self.generate_url_contents(url)
header = click.style('Viewing ' + url + '\n\n',
fg=self.config.clr_message)
contents = header + contents
contents += click.style(('\nView this article in a browser with'
' the -b/--browser flag.\n'),
fg=self.config.clr_message)
contents += click.style(('\nPress q to quit viewing this '
'article.\n'),
fg=self.config.clr_message)
if contents == '{"error":"Not Found"}\n':
click.secho('Invalid user/repo combination.')
return
color = None
if platform.system() == 'Windows':
color = True
click.echo_via_pager(contents, color)
评论列表
文章目录