Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
hub
提交
cc38879b
H
hub
项目概览
github
/
hub
11 个月 前同步成功
通知
3
Star
22523
Fork
2406
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
cc38879b
编写于
12月 21, 2018
作者:
M
Mislav Marohnić
提交者:
GitHub
12月 21, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1976 from github/format-docs
Don't choke on literal `%` output from `--format` use
上级
de3f86fc
f8feb335
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
47 addition
and
6 deletion
+47
-6
commands/issue.go
commands/issue.go
+7
-3
commands/pr.go
commands/pr.go
+5
-1
commands/release.go
commands/release.go
+6
-2
features/issue.feature
features/issue.feature
+20
-0
ui/ui.go
ui/ui.go
+9
-0
未找到文件。
commands/issue.go
浏览文件 @
cc38879b
...
...
@@ -105,6 +105,10 @@ With no arguments, show a list of open issues.
%uI: updated date, ISO 8601 format
%n: newline
%%: a literal %
-m, --message=<MESSAGE>
The text up to the first blank line in <MESSAGE> is treated as the issue
title, and the rest is used as issue description in Markdown format.
...
...
@@ -294,7 +298,7 @@ func listIssues(cmd *Command, args *Args) {
colorize
:=
ui
.
IsTerminal
(
os
.
Stdout
)
for
_
,
issue
:=
range
issues
{
ui
.
Print
f
(
formatIssue
(
issue
,
flagIssueFormat
,
colorize
))
ui
.
Print
(
formatIssue
(
issue
,
flagIssueFormat
,
colorize
))
}
}
...
...
@@ -451,7 +455,7 @@ func showIssue(cmd *Command, args *Args) {
colorize
:=
ui
.
IsTerminal
(
os
.
Stdout
)
if
flagShowIssueFormat
!=
""
{
ui
.
Print
f
(
formatIssue
(
*
issue
,
flagShowIssueFormat
,
colorize
))
ui
.
Print
(
formatIssue
(
*
issue
,
flagShowIssueFormat
,
colorize
))
return
}
...
...
@@ -581,7 +585,7 @@ func listLabels(cmd *Command, args *Args) {
utils
.
Check
(
err
)
for
_
,
label
:=
range
labels
{
ui
.
Print
f
(
formatLabel
(
label
,
flagLabelsColorize
))
ui
.
Print
(
formatLabel
(
label
,
flagLabelsColorize
))
}
}
...
...
commands/pr.go
浏览文件 @
cc38879b
...
...
@@ -113,6 +113,10 @@ pr checkout <PR-NUMBER> [<BRANCH>]
%mI: merged date, ISO 8601 format
%n: newline
%%: a literal %
-o, --sort=<SORT_KEY>
Sort displayed issues by "created" (default), "updated", "popularity", or "long-running".
...
...
@@ -216,7 +220,7 @@ func listPulls(cmd *Command, args *Args) {
colorize
:=
ui
.
IsTerminal
(
os
.
Stdout
)
for
_
,
pr
:=
range
pulls
{
ui
.
Print
f
(
formatPullRequest
(
pr
,
flagPullRequestFormat
,
colorize
))
ui
.
Print
(
formatPullRequest
(
pr
,
flagPullRequestFormat
,
colorize
))
}
}
...
...
commands/release.go
浏览文件 @
cc38879b
...
...
@@ -136,6 +136,10 @@ With '--exclude-prereleases', exclude non-stable releases from the listing.
%pI: published date, ISO 8601 format
%n: newline
%%: a literal %
<TAG>
The git tag name for this release.
...
...
@@ -246,7 +250,7 @@ func listReleases(cmd *Command, args *Args) {
colorize
:=
ui
.
IsTerminal
(
os
.
Stdout
)
for
_
,
release
:=
range
releases
{
ui
.
Print
f
(
formatRelease
(
release
,
flagReleaseFormat
,
colorize
))
ui
.
Print
(
formatRelease
(
release
,
flagReleaseFormat
,
colorize
))
}
}
...
...
@@ -334,7 +338,7 @@ func showRelease(cmd *Command, args *Args) {
colorize
:=
ui
.
IsTerminal
(
os
.
Stdout
)
if
flagShowReleaseFormat
!=
""
{
ui
.
Print
f
(
formatRelease
(
*
release
,
flagShowReleaseFormat
,
colorize
))
ui
.
Print
(
formatRelease
(
*
release
,
flagShowReleaseFormat
,
colorize
))
return
}
...
...
features/issue.feature
浏览文件 @
cc38879b
...
...
@@ -614,6 +614,26 @@ Feature: hub issue
I want this feature\n
"""
Scenario
:
Format with literal % characters
Given the GitHub API server
:
"""
get('/repos/github/hub/issues/102') {
json \
:number => 102,
:state => "open",
:title => "Feature request % hub",
:user => { :login => "alexfornuto" }
}
get('/repos/github/hub/issues/102/comments') {
json []
}
"""
When
I successfully run `hub issue show 102 --format='%t%%t%%n%n'`
Then the output should contain exactly
:
"""
Feature request % hub%t%n\n
"""
Scenario
:
Did not supply an issue number
When
I run `hub issue show`
Then
the exit status should be 1
...
...
ui/ui.go
浏览文件 @
cc38879b
...
...
@@ -10,6 +10,7 @@ import (
)
type
UI
interface
{
Print
(
a
...
interface
{})
(
n
int
,
err
error
)
Printf
(
format
string
,
a
...
interface
{})
(
n
int
,
err
error
)
Println
(
a
...
interface
{})
(
n
int
,
err
error
)
Errorf
(
format
string
,
a
...
interface
{})
(
n
int
,
err
error
)
...
...
@@ -22,6 +23,10 @@ var (
Default
UI
=
Console
{
Stdout
:
Stdout
,
Stderr
:
Stderr
}
)
func
Print
(
a
...
interface
{})
(
n
int
,
err
error
)
{
return
Default
.
Print
(
a
...
)
}
func
Printf
(
format
string
,
a
...
interface
{})
(
n
int
,
err
error
)
{
return
Default
.
Printf
(
format
,
a
...
)
}
...
...
@@ -47,6 +52,10 @@ type Console struct {
Stderr
io
.
Writer
}
func
(
c
Console
)
Print
(
a
...
interface
{})
(
n
int
,
err
error
)
{
return
fmt
.
Fprint
(
c
.
Stdout
,
a
...
)
}
func
(
c
Console
)
Printf
(
format
string
,
a
...
interface
{})
(
n
int
,
err
error
)
{
return
fmt
.
Fprintf
(
c
.
Stdout
,
format
,
a
...
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录