Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
hub
提交
3e619174
H
hub
项目概览
github
/
hub
8 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
3e619174
编写于
3月 20, 2020
作者:
K
kfcampbell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More minor updates.
上级
9c9a489b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
19 addition
and
21 deletion
+19
-21
cmd/cmd.go
cmd/cmd.go
+1
-0
commands/clone.go
commands/clone.go
+2
-2
commands/commands.go
commands/commands.go
+8
-8
commands/compare.go
commands/compare.go
+1
-2
commands/create.go
commands/create.go
+2
-2
commands/help.go
commands/help.go
+5
-7
未找到文件。
cmd/cmd.go
浏览文件 @
3e619174
...
...
@@ -24,6 +24,7 @@ func (cmd Cmd) String() string {
return
fmt
.
Sprintf
(
"%s %s"
,
cmd
.
Name
,
strings
.
Join
(
cmd
.
Args
,
" "
))
}
// WithArg returns the current argument
func
(
cmd
*
Cmd
)
WithArg
(
arg
string
)
*
Cmd
{
cmd
.
Args
=
append
(
cmd
.
Args
,
arg
)
...
...
commands/clone.go
浏览文件 @
3e619174
...
...
@@ -79,7 +79,7 @@ func transformCloneArgs(args *Args) {
for
_
,
i
:=
range
p
.
PositionalIndices
{
a
:=
args
.
Params
[
i
]
if
nameWithOwnerRegexp
.
MatchString
(
a
)
&&
!
isCloneable
(
a
)
{
url
:=
getCloneU
rl
(
a
,
isSSH
,
args
.
Command
!=
"submodule"
)
url
:=
getCloneU
RL
(
a
,
isSSH
,
args
.
Command
!=
"submodule"
)
args
.
ReplaceParam
(
i
,
url
)
}
break
...
...
@@ -95,7 +95,7 @@ func parseClonePrivateFlag(args *Args) bool {
return
false
}
func
getCloneU
rl
(
nameWithOwner
string
,
isSSH
,
allowSSH
bool
)
string
{
func
getCloneU
RL
(
nameWithOwner
string
,
isSSH
,
allowSSH
bool
)
string
{
name
:=
nameWithOwner
owner
:=
""
if
strings
.
Contains
(
name
,
"/"
)
{
...
...
commands/commands.go
浏览文件 @
3e619174
...
...
@@ -62,16 +62,16 @@ func (c *Command) parseArguments(args *Args) error {
}
args
.
Flag
=
utils
.
NewArgsParserWithUsage
(
"-h, --help
\n
"
+
knownFlags
)
if
rest
,
err
:=
args
.
Flag
.
Parse
(
args
.
Params
);
err
==
nil
{
if
args
.
Flag
.
Bool
(
"--help"
)
{
return
&
ErrHelp
{
err
:
c
.
Synopsis
()}
}
args
.
Params
=
rest
args
.
Terminator
=
args
.
Flag
.
HasTerminated
return
nil
}
else
{
rest
,
err
:=
args
.
Flag
.
Parse
(
args
.
Params
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"%s
\n
%s"
,
err
,
c
.
Synopsis
())
}
if
args
.
Flag
.
Bool
(
"--help"
)
{
return
&
ErrHelp
{
err
:
c
.
Synopsis
()}
}
args
.
Params
=
rest
args
.
Terminator
=
args
.
Flag
.
HasTerminated
return
nil
}
func
(
c
*
Command
)
Use
(
subCommand
*
Command
)
{
...
...
commands/compare.go
浏览文件 @
3e619174
...
...
@@ -149,7 +149,6 @@ var compareUnescaper = strings.NewReplacer(
func
rangeQueryEscape
(
r
string
)
string
{
if
strings
.
Contains
(
r
,
".."
)
{
return
r
}
else
{
return
compareUnescaper
.
Replace
(
url
.
QueryEscape
(
r
))
}
return
compareUnescaper
.
Replace
(
url
.
QueryEscape
(
r
))
}
commands/create.go
浏览文件 @
3e619174
...
...
@@ -143,9 +143,9 @@ func create(command *Command, args *Args) {
args
.
Before
(
"git"
,
"remote"
,
"add"
,
"-f"
,
originName
,
url
)
}
webU
rl
:=
project
.
WebURL
(
""
,
""
,
""
)
webU
RL
:=
project
.
WebURL
(
""
,
""
,
""
)
args
.
NoForward
()
flagCreateBrowse
:=
args
.
Flag
.
Bool
(
"--browse"
)
flagCreateCopy
:=
args
.
Flag
.
Bool
(
"--copy"
)
printBrowseOrCopy
(
args
,
webU
rl
,
flagCreateBrowse
,
flagCreateCopy
)
printBrowseOrCopy
(
args
,
webU
RL
,
flagCreateBrowse
,
flagCreateCopy
)
}
commands/help.go
浏览文件 @
3e619174
...
...
@@ -189,14 +189,12 @@ func displayManPage(manPage string, args *Args, isWeb bool) error {
func
lookupCmd
(
name
string
)
*
Command
{
if
strings
.
HasPrefix
(
name
,
"hub-"
)
{
return
CmdRunner
.
Lookup
(
strings
.
TrimPrefix
(
name
,
"hub-"
))
}
else
{
cmd
:=
CmdRunner
.
Lookup
(
name
)
if
cmd
!=
nil
&&
!
cmd
.
GitExtension
{
return
cmd
}
else
{
return
nil
}
}
cmd
:=
CmdRunner
.
Lookup
(
name
)
if
cmd
!=
nil
&&
!
cmd
.
GitExtension
{
return
cmd
}
return
nil
}
func
customCommands
()
[]
string
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录