Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
e67fdd53
提交
e67fdd53
authored
5月 13, 2016
作者:
Jeromy Johnson
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2674 from ipfs/feature/add-default-to-object-cmd
Added Default logic to object object and patch
上级
df1ac97c
c68aa06c
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
7 行增加
和
10 行删除
+7
-10
object.go
core/commands/object/object.go
+4
-7
patch.go
core/commands/object/patch.go
+3
-3
没有找到文件。
core/commands/object/object.go
浏览文件 @
e67fdd53
...
...
@@ -113,7 +113,7 @@ multihash.
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)."
),
cmds
.
BoolOption
(
"headers"
,
"v"
,
"Print table headers (Hash, Size, Name)."
)
.
Default
(
false
)
,
},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
n
,
err
:=
req
.
InvocContext
()
.
GetNode
()
...
...
@@ -335,7 +335,7 @@ And then run:
cmds
.
FileArg
(
"data"
,
true
,
false
,
"Data to be stored as a DAG object."
)
.
EnableStdin
(),
},
Options
:
[]
cmds
.
Option
{
cmds
.
StringOption
(
"inputenc"
,
"Encoding type of input data
, either
\"
protobuf
\"
or
\"
json
\"
.
"
),
cmds
.
StringOption
(
"inputenc"
,
"Encoding type of input data
. One of: {
\"
protobuf
\"
,
\"
json
\"
}."
)
.
Default
(
"json
"
),
cmds
.
StringOption
(
"datafieldenc"
,
"Encoding type of the data field, either
\"
text
\"
or
\"
base64
\"
."
)
.
Default
(
"text"
),
},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
...
...
@@ -351,16 +351,13 @@ And then run:
return
}
inputenc
,
found
,
err
:=
req
.
Option
(
"inputenc"
)
.
String
()
inputenc
,
_
,
err
:=
req
.
Option
(
"inputenc"
)
.
String
()
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
}
if
!
found
{
inputenc
=
"json"
}
datafieldenc
,
found
,
err
:=
req
.
Option
(
"datafieldenc"
)
.
String
()
datafieldenc
,
_
,
err
:=
req
.
Option
(
"datafieldenc"
)
.
String
()
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
...
...
core/commands/object/patch.go
浏览文件 @
e67fdd53
...
...
@@ -246,14 +246,14 @@ This takes an empty directory, and adds a link named 'foo' under it, pointing to
a file containing 'bar', and returns the hash of the new object.
`
,
},
Options
:
[]
cmds
.
Option
{
cmds
.
BoolOption
(
"p"
,
"create"
,
"Create intermediary nodes."
),
},
Arguments
:
[]
cmds
.
Argument
{
cmds
.
StringArg
(
"root"
,
true
,
false
,
"The hash of the node to modify."
),
cmds
.
StringArg
(
"name"
,
true
,
false
,
"Name of link to create."
),
cmds
.
StringArg
(
"ref"
,
true
,
false
,
"IPFS object to add link to."
),
},
Options
:
[]
cmds
.
Option
{
cmds
.
BoolOption
(
"p"
,
"create"
,
"Create intermediary nodes."
)
.
Default
(
false
),
},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
nd
,
err
:=
req
.
InvocContext
()
.
GetNode
()
if
err
!=
nil
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论