Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
15cd24a6
提交
15cd24a6
authored
11月 03, 2014
作者:
Matt Bell
提交者:
Juan Batiz-Benet
11月 14, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
commands: Renamed Response#Value to Response#Output
上级
f1209d09
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
16 行增加
和
16 行删除
+16
-16
add.go
core/commands2/add.go
+2
-2
cat.go
core/commands2/cat.go
+1
-1
commands.go
core/commands2/commands.go
+2
-2
log.go
core/commands2/log.go
+1
-1
ls.go
core/commands2/ls.go
+2
-2
publish.go
core/commands2/publish.go
+2
-2
root.go
core/commands2/root.go
+6
-6
没有找到文件。
core/commands2/add.go
浏览文件 @
15cd24a6
...
...
@@ -53,10 +53,10 @@ var addCmd = &cmds.Command{
added
[
i
]
=
Object
{
k
.
String
(),
nil
}
}
res
.
Set
Value
(
&
AddOutput
{
added
})
res
.
Set
Output
(
&
AddOutput
{
added
})
},
Format
:
func
(
res
cmds
.
Response
)
(
string
,
error
)
{
v
:=
res
.
Value
()
.
(
*
AddOutput
)
.
Added
v
:=
res
.
Output
()
.
(
*
AddOutput
)
.
Added
if
len
(
v
)
==
1
{
return
fmt
.
Sprintf
(
"Added object: %s
\n
"
,
v
[
0
]
.
Hash
),
nil
}
...
...
core/commands2/cat.go
浏览文件 @
15cd24a6
...
...
@@ -34,6 +34,6 @@ var catCmd = &cmds.Command{
}
reader
:=
io
.
MultiReader
(
readers
...
)
res
.
Set
Value
(
reader
)
res
.
Set
Output
(
reader
)
},
}
core/commands2/commands.go
浏览文件 @
15cd24a6
...
...
@@ -16,10 +16,10 @@ var commandsCmd = &cmds.Command{
Help
:
"TODO"
,
Run
:
func
(
res
cmds
.
Response
,
req
cmds
.
Request
)
{
root
:=
outputCommand
(
"ipfs"
,
Root
)
res
.
Set
Value
(
&
root
)
res
.
Set
Output
(
&
root
)
},
Format
:
func
(
res
cmds
.
Response
)
(
string
,
error
)
{
v
:=
res
.
Value
()
.
(
*
Command
)
v
:=
res
.
Output
()
.
(
*
Command
)
return
formatCommand
(
v
,
0
),
nil
},
Type
:
&
Command
{},
...
...
core/commands2/log.go
浏览文件 @
15cd24a6
...
...
@@ -21,7 +21,7 @@ var logCmd = &cmds.Command{
}
s
:=
fmt
.
Sprintf
(
"Changed log level of '%s' to '%s'"
,
args
[
0
],
args
[
1
])
res
.
Set
Value
(
&
MessageOutput
{
s
})
res
.
Set
Output
(
&
MessageOutput
{
s
})
},
Format
:
MessageFormatter
,
Type
:
&
MessageOutput
{},
...
...
core/commands2/ls.go
浏览文件 @
15cd24a6
...
...
@@ -50,11 +50,11 @@ var lsCmd = &cmds.Command{
}
}
res
.
Set
Value
(
&
LsOutput
{
output
})
res
.
Set
Output
(
&
LsOutput
{
output
})
},
Format
:
func
(
res
cmds
.
Response
)
(
string
,
error
)
{
s
:=
""
output
:=
res
.
Value
()
.
(
*
LsOutput
)
.
Objects
output
:=
res
.
Output
()
.
(
*
LsOutput
)
.
Objects
for
_
,
object
:=
range
output
{
if
len
(
output
)
>
1
{
...
...
core/commands2/publish.go
浏览文件 @
15cd24a6
...
...
@@ -56,13 +56,13 @@ var publishCmd = &cmds.Command{
return
}
res
.
Set
Value
(
&
PublishOutput
{
res
.
Set
Output
(
&
PublishOutput
{
Name
:
u
.
Key
(
hash
)
.
String
(),
Value
:
ref
,
})
},
Format
:
func
(
res
cmds
.
Response
)
(
string
,
error
)
{
v
:=
res
.
Value
()
.
(
*
PublishOutput
)
v
:=
res
.
Output
()
.
(
*
PublishOutput
)
return
fmt
.
Sprintf
(
"Published name %s to %s
\n
"
,
v
.
Name
,
v
.
Value
),
nil
},
Type
:
&
PublishOutput
{},
...
...
core/commands2/root.go
浏览文件 @
15cd24a6
...
...
@@ -69,10 +69,10 @@ var rootSubcommands = map[string]*cmds.Command{
Run
:
func
(
res
cmds
.
Response
,
req
cmds
.
Request
)
{
v
:=
&
TestOutput
{
"hello, world"
,
1337
}
log
.
Info
(
"beep"
)
res
.
Set
Value
(
v
)
res
.
Set
Output
(
v
)
},
Format
:
func
(
res
cmds
.
Response
)
(
string
,
error
)
{
v
:=
res
.
Value
()
.
(
*
TestOutput
)
v
:=
res
.
Output
()
.
(
*
TestOutput
)
s
:=
fmt
.
Sprintf
(
"Foo: %s
\n
"
,
v
.
Foo
)
s
+=
fmt
.
Sprintf
(
"Bar: %v
\n
"
,
v
.
Bar
)
return
s
,
nil
...
...
@@ -82,7 +82,7 @@ var rootSubcommands = map[string]*cmds.Command{
"boop"
:
&
cmds
.
Command
{
Run
:
func
(
res
cmds
.
Response
,
req
cmds
.
Request
)
{
v
:=
strings
.
NewReader
(
"hello, world"
)
res
.
Set
Value
(
v
)
res
.
Set
Output
(
v
)
},
},
"warp"
:
&
cmds
.
Command
{
...
...
@@ -93,7 +93,7 @@ var rootSubcommands = map[string]*cmds.Command{
threshold
:=
1.21
if
power
,
found
:=
req
.
Option
(
"power"
);
found
&&
power
.
(
float64
)
>=
threshold
{
res
.
Set
Value
(
struct
{
res
.
Set
Output
(
struct
{
Status
string
Power
float64
}{
"Flux capacitor activated!"
,
power
.
(
float64
)})
...
...
@@ -106,7 +106,7 @@ var rootSubcommands = map[string]*cmds.Command{
},
"args"
:
&
cmds
.
Command
{
Run
:
func
(
res
cmds
.
Response
,
req
cmds
.
Request
)
{
res
.
Set
Value
(
req
.
Arguments
())
res
.
Set
Output
(
req
.
Arguments
())
},
},
}
...
...
@@ -121,5 +121,5 @@ type MessageOutput struct {
}
func
MessageFormatter
(
res
cmds
.
Response
)
(
string
,
error
)
{
return
res
.
Value
()
.
(
*
MessageOutput
)
.
Message
,
nil
return
res
.
Output
()
.
(
*
MessageOutput
)
.
Message
,
nil
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论