Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
5d301cb8
提交
5d301cb8
authored
7月 08, 2016
作者:
Jeromy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
re-enable the stdin
License: MIT Signed-off-by:
Jeromy
<
why@ipfs.io
>
上级
cd467437
隐藏空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
39 行增加
和
59 行删除
+39
-59
bootstrap.go
core/commands/bootstrap.go
+8
-8
cat.go
core/commands/cat.go
+1
-1
dht.go
core/commands/dht.go
+1
-1
dns.go
core/commands/dns.go
+1
-1
get.go
core/commands/get.go
+1
-1
id.go
core/commands/id.go
+1
-1
ls.go
core/commands/ls.go
+1
-1
object.go
core/commands/object/object.go
+4
-4
pin.go
core/commands/pin.go
+6
-7
ping.go
core/commands/ping.go
+1
-1
publish.go
core/commands/publish.go
+1
-1
refs.go
core/commands/refs.go
+1
-1
resolve.go
core/commands/resolve.go
+1
-1
swarm.go
core/commands/swarm.go
+4
-4
tar.go
core/commands/tar.go
+1
-1
ls.go
core/commands/unixfs/ls.go
+1
-1
t0040-add-and-cat.sh
test/sharness/t0040-add-and-cat.sh
+5
-24
没有找到文件。
core/commands/bootstrap.go
浏览文件 @
5d301cb8
...
...
@@ -132,13 +132,13 @@ var bootstrapRemoveCmd = &cmds.Command{
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"peer"
,
false
,
true
,
peerOptionDesc
),
cmds
.
StringArg
(
"peer"
,
false
,
true
,
peerOptionDesc
)
.
EnableStdin
()
,
},
Options
:
[]
cmds
.
Option
{
cmds
.
BoolOption
(
"all"
,
"Remove all bootstrap peers."
)
.
Default
(
false
),
},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
input
,
err
:=
config
.
ParseBootstrapPeers
(
req
.
Arguments
()
)
all
,
_
,
err
:=
req
.
Option
(
"all"
)
.
Bool
(
)
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
...
...
@@ -156,16 +156,16 @@ var bootstrapRemoveCmd = &cmds.Command{
return
}
all
,
_
,
err
:=
req
.
Option
(
"all"
)
.
Bool
()
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
}
var
removed
[]
config
.
BootstrapPeer
if
all
{
removed
,
err
=
bootstrapRemoveAll
(
r
,
cfg
)
}
else
{
input
,
perr
:=
config
.
ParseBootstrapPeers
(
req
.
Arguments
())
if
perr
!=
nil
{
res
.
SetError
(
perr
,
cmds
.
ErrNormal
)
return
}
removed
,
err
=
bootstrapRemove
(
r
,
cfg
,
input
)
}
if
err
!=
nil
{
...
...
core/commands/cat.go
浏览文件 @
5d301cb8
...
...
@@ -20,7 +20,7 @@ var CatCmd = &cmds.Command{
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"ipfs-path"
,
true
,
true
,
"The path to the IPFS object(s) to be outputted."
),
cmds
.
StringArg
(
"ipfs-path"
,
true
,
true
,
"The path to the IPFS object(s) to be outputted."
)
.
EnableStdin
()
,
},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
node
,
err
:=
req
.
InvocContext
()
.
GetNode
()
...
...
core/commands/dht.go
浏览文件 @
5d301cb8
...
...
@@ -459,7 +459,7 @@ NOTE: A value may not exceed 2048 bytes.
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"key"
,
true
,
false
,
"The key to store the value at."
),
cmds
.
StringArg
(
"value"
,
true
,
false
,
"The value to store."
),
cmds
.
StringArg
(
"value"
,
true
,
false
,
"The value to store."
)
.
EnableStdin
()
,
},
Options
:
[]
cmds
.
Option
{
cmds
.
BoolOption
(
"verbose"
,
"v"
,
"Print extra information."
)
.
Default
(
false
),
...
...
core/commands/dns.go
浏览文件 @
5d301cb8
...
...
@@ -44,7 +44,7 @@ The resolver can recursively resolve:
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"domain-name"
,
true
,
false
,
"The domain-name name to resolve."
),
cmds
.
StringArg
(
"domain-name"
,
true
,
false
,
"The domain-name name to resolve."
)
.
EnableStdin
()
,
},
Options
:
[]
cmds
.
Option
{
cmds
.
BoolOption
(
"recursive"
,
"r"
,
"Resolve until the result is not a DNS link."
)
.
Default
(
false
),
...
...
core/commands/get.go
浏览文件 @
5d301cb8
...
...
@@ -37,7 +37,7 @@ may also specify the level of compression by specifying '-l=<1-9>'.
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"ipfs-path"
,
true
,
false
,
"The path to the IPFS object(s) to be outputted."
),
cmds
.
StringArg
(
"ipfs-path"
,
true
,
false
,
"The path to the IPFS object(s) to be outputted."
)
.
EnableStdin
()
,
},
Options
:
[]
cmds
.
Option
{
cmds
.
StringOption
(
"output"
,
"o"
,
"The path where the output should be stored."
),
...
...
core/commands/id.go
浏览文件 @
5d301cb8
...
...
@@ -58,7 +58,7 @@ EXAMPLE:
`
,
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"peerid"
,
false
,
false
,
"Peer.ID of node to look up."
),
cmds
.
StringArg
(
"peerid"
,
false
,
false
,
"Peer.ID of node to look up."
)
.
EnableStdin
()
,
},
Options
:
[]
cmds
.
Option
{
cmds
.
StringOption
(
"format"
,
"f"
,
"Optional output format."
),
...
...
core/commands/ls.go
浏览文件 @
5d301cb8
...
...
@@ -42,7 +42,7 @@ format:
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"ipfs-path"
,
true
,
true
,
"The path to the IPFS object(s) to list links from."
),
cmds
.
StringArg
(
"ipfs-path"
,
true
,
true
,
"The path to the IPFS object(s) to list links from."
)
.
EnableStdin
()
,
},
Options
:
[]
cmds
.
Option
{
cmds
.
BoolOption
(
"headers"
,
"v"
,
"Print table headers (Hash, Size, Name)."
)
.
Default
(
false
),
...
...
core/commands/object/object.go
浏览文件 @
5d301cb8
...
...
@@ -78,7 +78,7 @@ is the raw data of the object.
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"key"
,
true
,
false
,
"Key of the object to retrieve, in base58-encoded multihash format."
),
cmds
.
StringArg
(
"key"
,
true
,
false
,
"Key of the object to retrieve, in base58-encoded multihash format."
)
.
EnableStdin
()
,
},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
n
,
err
:=
req
.
InvocContext
()
.
GetNode
()
...
...
@@ -108,7 +108,7 @@ multihash.
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"key"
,
true
,
false
,
"Key of the object to retrieve, in base58-encoded multihash format."
),
cmds
.
StringArg
(
"key"
,
true
,
false
,
"Key of the object to retrieve, in base58-encoded multihash format."
)
.
EnableStdin
()
,
},
Options
:
[]
cmds
.
Option
{
cmds
.
BoolOption
(
"headers"
,
"v"
,
"Print table headers (Hash, Size, Name)."
)
.
Default
(
false
),
...
...
@@ -179,7 +179,7 @@ This command outputs data in the following encodings:
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"key"
,
true
,
false
,
"Key of the object to retrieve, in base58-encoded multihash format."
),
cmds
.
StringArg
(
"key"
,
true
,
false
,
"Key of the object to retrieve, in base58-encoded multihash format."
)
.
EnableStdin
()
,
},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
n
,
err
:=
req
.
InvocContext
()
.
GetNode
()
...
...
@@ -246,7 +246,7 @@ var ObjectStatCmd = &cmds.Command{
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"key"
,
true
,
false
,
"Key of the object to retrieve, in base58-encoded multihash format."
),
cmds
.
StringArg
(
"key"
,
true
,
false
,
"Key of the object to retrieve, in base58-encoded multihash format."
)
.
EnableStdin
()
,
},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
n
,
err
:=
req
.
InvocContext
()
.
GetNode
()
...
...
core/commands/pin.go
浏览文件 @
5d301cb8
...
...
@@ -71,6 +71,11 @@ var addPinCmd = &cmds.Command{
},
Marshalers
:
cmds
.
MarshalerMap
{
cmds
.
Text
:
func
(
res
cmds
.
Response
)
(
io
.
Reader
,
error
)
{
added
,
ok
:=
res
.
Output
()
.
(
*
PinOutput
)
if
!
ok
{
return
nil
,
u
.
ErrCast
()
}
var
pintype
string
rec
,
found
,
_
:=
res
.
Request
()
.
Option
(
"recursive"
)
.
Bool
()
if
rec
||
!
found
{
...
...
@@ -79,17 +84,11 @@ var addPinCmd = &cmds.Command{
pintype
=
"directly"
}
po
,
ok
:=
res
.
Output
()
.
(
*
PinOutput
)
if
!
ok
{
return
nil
,
u
.
ErrCast
()
}
buf
:=
new
(
bytes
.
Buffer
)
for
_
,
k
:=
range
po
.
Pins
{
for
_
,
k
:=
range
added
.
Pins
{
fmt
.
Fprintf
(
buf
,
"pinned %s %s
\n
"
,
k
,
pintype
)
}
return
buf
,
nil
},
},
}
...
...
core/commands/ping.go
浏览文件 @
5d301cb8
...
...
@@ -36,7 +36,7 @@ trip latency information.
`
,
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"peer ID"
,
true
,
true
,
"ID of peer to be pinged."
),
cmds
.
StringArg
(
"peer ID"
,
true
,
true
,
"ID of peer to be pinged."
)
.
EnableStdin
()
,
},
Options
:
[]
cmds
.
Option
{
cmds
.
IntOption
(
"count"
,
"n"
,
"Number of ping messages to send."
)
.
Default
(
10
),
...
...
core/commands/publish.go
浏览文件 @
5d301cb8
...
...
@@ -47,7 +47,7 @@ Publish an <ipfs-path> to another public key (not implemented):
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"ipfs-path"
,
true
,
false
,
"IPFS path of the object to be published."
),
cmds
.
StringArg
(
"ipfs-path"
,
true
,
false
,
"IPFS path of the object to be published."
)
.
EnableStdin
()
,
},
Options
:
[]
cmds
.
Option
{
cmds
.
BoolOption
(
"resolve"
,
"Resolve given path before publishing."
)
.
Default
(
true
),
...
...
core/commands/refs.go
浏览文件 @
5d301cb8
...
...
@@ -46,7 +46,7 @@ NOTE: List all references recursively by using the flag '-r'.
"local"
:
RefsLocalCmd
,
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"ipfs-path"
,
true
,
true
,
"Path to the object(s) to list refs from."
),
cmds
.
StringArg
(
"ipfs-path"
,
true
,
true
,
"Path to the object(s) to list refs from."
)
.
EnableStdin
()
,
},
Options
:
[]
cmds
.
Option
{
cmds
.
StringOption
(
"format"
,
"Emit edges with given format. Available tokens: <src> <dst> <linkname>."
)
.
Default
(
"<dst>"
),
...
...
core/commands/resolve.go
浏览文件 @
5d301cb8
...
...
@@ -56,7 +56,7 @@ Resolve the value of an IPFS DAG path:
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"name"
,
true
,
false
,
"The name to resolve."
),
cmds
.
StringArg
(
"name"
,
true
,
false
,
"The name to resolve."
)
.
EnableStdin
()
,
},
Options
:
[]
cmds
.
Option
{
cmds
.
BoolOption
(
"recursive"
,
"r"
,
"Resolve until the result is an IPFS name."
)
.
Default
(
false
),
...
...
core/commands/swarm.go
浏览文件 @
5d301cb8
...
...
@@ -215,7 +215,7 @@ ipfs swarm connect /ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3
`
,
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"address"
,
true
,
true
,
"Address of peer to connect to."
),
cmds
.
StringArg
(
"address"
,
true
,
true
,
"Address of peer to connect to."
)
.
EnableStdin
()
,
},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
ctx
:=
req
.
Context
()
...
...
@@ -283,7 +283,7 @@ it will reconnect.
`
,
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"address"
,
true
,
true
,
"Address of peer to disconnect from."
),
cmds
.
StringArg
(
"address"
,
true
,
true
,
"Address of peer to disconnect from."
)
.
EnableStdin
()
,
},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
n
,
err
:=
req
.
InvocContext
()
.
GetNode
()
...
...
@@ -451,7 +451,7 @@ add your filters to the ipfs config file.
`
,
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"address"
,
true
,
true
,
"Multiaddr to filter."
),
cmds
.
StringArg
(
"address"
,
true
,
true
,
"Multiaddr to filter."
)
.
EnableStdin
()
,
},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
n
,
err
:=
req
.
InvocContext
()
.
GetNode
()
...
...
@@ -523,7 +523,7 @@ remove your filters from the ipfs config file.
`
,
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"address"
,
true
,
true
,
"Multiaddr filter to remove."
),
cmds
.
StringArg
(
"address"
,
true
,
true
,
"Multiaddr filter to remove."
)
.
EnableStdin
()
,
},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
n
,
err
:=
req
.
InvocContext
()
.
GetNode
()
...
...
core/commands/tar.go
浏览文件 @
5d301cb8
...
...
@@ -83,7 +83,7 @@ var tarCatCmd = &cmds.Command{
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"path"
,
true
,
false
,
"IPFS path of archive to export."
),
cmds
.
StringArg
(
"path"
,
true
,
false
,
"IPFS path of archive to export."
)
.
EnableStdin
()
,
},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
nd
,
err
:=
req
.
InvocContext
()
.
GetNode
()
...
...
core/commands/unixfs/ls.go
浏览文件 @
5d301cb8
...
...
@@ -63,7 +63,7 @@ Example:
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"ipfs-path"
,
true
,
true
,
"The path to the IPFS object(s) to list links from."
),
cmds
.
StringArg
(
"ipfs-path"
,
true
,
true
,
"The path to the IPFS object(s) to list links from."
)
.
EnableStdin
()
,
},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
node
,
err
:=
req
.
InvocContext
()
.
GetNode
()
...
...
test/sharness/t0040-add-and-cat.sh
浏览文件 @
5d301cb8
...
...
@@ -212,7 +212,7 @@ test_expect_success "ipfs cat output looks good" '
'
test_expect_success
"ipfs cat accept hash from built input"
'
echo "$HASH" |
xargs
ipfs cat >actual
echo "$HASH" | ipfs cat >actual
'
test_expect_success
"ipfs cat output looks good"
'
...
...
@@ -268,7 +268,7 @@ test_expect_success "'ipfs add' output looks good" '
'
test_expect_success
"'ipfs cat' with built input succeeds"
'
echo "$HASH" |
xargs
ipfs cat >actual
echo "$HASH" | ipfs cat >actual
'
test_expect_success
"ipfs cat with built input output looks good"
'
...
...
@@ -319,7 +319,7 @@ test_expect_success "'ipfs add -rn' output looks good" '
'
test_expect_success
"ipfs cat accept many hashes from built input"
'
{ echo "$MARS"; echo "$VENUS"; } |
xargs
ipfs cat >actual
{ echo "$MARS"; echo "$VENUS"; } | ipfs cat >actual
'
test_expect_success
"ipfs cat output looks good"
'
...
...
@@ -335,28 +335,9 @@ test_expect_success "ipfs cat output looks good" '
test_cmp expected actual
'
test_expect_success
"ipfs cat with both arg and built input"
'
echo "$MARS" | xargs ipfs cat "$VENUS" >actual
'
test_expect_success
"ipfs cat output looks good"
'
cat mountdir/planets/venus.txt mountdir/planets/mars.txt >expected &&
test_cmp expected actual
'
test_expect_success
"ipfs cat with two args and built input"
'
echo "$MARS" | xargs ipfs cat "$VENUS" "$VENUS" >actual
'
test_expect_success
"ipfs cat output looks good"
'
cat mountdir/planets/venus.txt mountdir/planets/venus.txt \
mountdir/planets/mars.txt >expected &&
test_cmp expected actual
'
test_expect_success
"go-random is installed"
'
type random
'
type random
'
test_add_cat_5MB
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论