Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
994109c7
提交
994109c7
authored
6月 02, 2016
作者:
Jeromy Johnson
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2790 from ipfs/feature/version-all
Add version --all option
上级
082393db
c8c329df
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
27 行增加
和
2 行删除
+27
-2
version.go
core/commands/version.go
+17
-0
t0010-basic-commands.sh
test/sharness/t0010-basic-commands.sh
+8
-0
t0500-issues-and-regressions-offline.sh
test/sharness/t0500-issues-and-regressions-offline.sh
+1
-1
t0600-issues-and-regressions-online.sh
test/sharness/t0600-issues-and-regressions-online.sh
+1
-1
没有找到文件。
core/commands/version.go
浏览文件 @
994109c7
...
...
@@ -3,6 +3,7 @@ package commands
import
(
"fmt"
"io"
"runtime"
"strings"
cmds
"github.com/ipfs/go-ipfs/commands"
...
...
@@ -14,6 +15,8 @@ type VersionOutput struct {
Version
string
Commit
string
Repo
string
System
string
Golang
string
}
var
VersionCmd
=
&
cmds
.
Command
{
...
...
@@ -26,12 +29,15 @@ var VersionCmd = &cmds.Command{
cmds
.
BoolOption
(
"number"
,
"n"
,
"Only show the version number."
)
.
Default
(
false
),
cmds
.
BoolOption
(
"commit"
,
"Show the commit hash."
)
.
Default
(
false
),
cmds
.
BoolOption
(
"repo"
,
"Show repo version."
)
.
Default
(
false
),
cmds
.
BoolOption
(
"all"
,
"Show all version information"
)
.
Default
(
false
),
},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
res
.
SetOutput
(
&
VersionOutput
{
Version
:
config
.
CurrentVersionNumber
,
Commit
:
config
.
CurrentCommit
,
Repo
:
fsrepo
.
RepoVersion
,
System
:
runtime
.
GOARCH
+
"/"
+
runtime
.
GOOS
,
//TODO: Precise version here
Golang
:
runtime
.
Version
(),
})
},
Marshalers
:
cmds
.
MarshalerMap
{
...
...
@@ -64,6 +70,17 @@ var VersionCmd = &cmds.Command{
return
strings
.
NewReader
(
fmt
.
Sprintln
(
v
.
Version
+
commitTxt
)),
nil
}
all
,
_
,
err
:=
res
.
Request
()
.
Option
(
"all"
)
.
Bool
()
if
err
!=
nil
{
return
nil
,
err
}
if
all
{
out
:=
fmt
.
Sprintf
(
"go-ipfs version: %s-%s
\n
"
+
"Repo version: %s
\n
System version: %s
\n
Golang version: %s
\n
"
,
v
.
Version
,
v
.
Commit
,
v
.
Repo
,
v
.
System
,
v
.
Golang
)
return
strings
.
NewReader
(
out
),
nil
}
return
strings
.
NewReader
(
fmt
.
Sprintf
(
"ipfs version %s%s
\n
"
,
v
.
Version
,
commitTxt
)),
nil
},
},
...
...
test/sharness/t0010-basic-commands.sh
浏览文件 @
994109c7
...
...
@@ -21,6 +21,14 @@ test_expect_success "ipfs version output looks good" '
test_fsh cat version.txt
'
test_expect_success
"ipfs version --all has all required fields"
'
ipfs version --all > version_all.txt &&
grep "go-ipfs version" version_all.txt &&
grep "Repo version" version_all.txt &&
grep "System version" version_all.txt &&
grep "Golang version" version_all.txt
'
test_expect_success
"ipfs help succeeds"
'
ipfs help >help.txt
'
...
...
test/sharness/t0500-issues-and-regressions-offline.sh
浏览文件 @
994109c7
#!/bin/sh
test_description
=
"Tests for various fxed issues and regressions."
test_description
=
"Tests for various f
i
xed issues and regressions."
.
lib/test-lib.sh
...
...
test/sharness/t0
501
-issues-and-regressions-online.sh
→
test/sharness/t0
600
-issues-and-regressions-online.sh
浏览文件 @
994109c7
#!/bin/sh
test_description
=
"Tests for various fxed issues and regressions."
test_description
=
"Tests for various f
i
xed issues and regressions."
.
lib/test-lib.sh
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论