Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
bb8d4ebd
提交
bb8d4ebd
authored
11月 13, 2014
作者:
Juan Batiz-Benet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cmds2: cmdDetailsMap
上级
ef0826ac
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
44 行增加
和
17 行删除
+44
-17
ipfs.go
cmd/ipfs2/ipfs.go
+28
-4
tour.go
cmd/ipfs2/tour.go
+1
-1
bootstrap.go
core/commands2/bootstrap.go
+3
-3
diag.go
core/commands2/diag.go
+1
-1
log.go
core/commands2/log.go
+1
-1
root.go
core/commands2/root.go
+8
-5
update.go
core/commands2/update.go
+1
-1
version.go
core/commands2/version.go
+1
-1
没有找到文件。
cmd/ipfs2/ipfs.go
浏览文件 @
bb8d4ebd
...
...
@@ -13,13 +13,16 @@ var Root = &cmds.Command{
Helptext
:
commands
.
Root
.
Helptext
,
}
// commandsClientCmd is the "ipfs commands" command for local cli
var
commandsClientCmd
=
commands
.
CommandsCmd
(
Root
)
// Commands in localCommands should always be run locally (even if daemon is running).
// They can override subcommands in commands.Root by defining a subcommand with the same name.
var
localCommands
=
map
[
string
]
*
cmds
.
Command
{
"daemon"
:
daemonCmd
,
// TODO name
"init"
:
initCmd
,
// TODO name
"tour"
:
cmdTour
,
"commands"
:
commands
.
CommandsCmd
(
Root
)
,
"daemon"
:
daemonCmd
,
"init"
:
initCmd
,
"tour"
:
tourCmd
,
"commands"
:
commands
ClientCmd
,
}
var
localMap
=
make
(
map
[
*
cmds
.
Command
]
bool
)
...
...
@@ -45,3 +48,24 @@ func isLocal(cmd *cmds.Command) bool {
_
,
found
:=
localMap
[
cmd
]
return
found
}
type
cmdDetails
struct
{
cannotRunOnClient
bool
cannotRunOnDaemon
bool
doesNotUseRepo
bool
}
// "What is this madness!?" you ask. Our commands have the unfortunate problem of
// not being able to run on all the same contexts. This map describes these
// properties so that other code can make decisions about whether to invoke a
// command or return an error to the user.
var
cmdDetailsMap
=
map
[
*
cmds
.
Command
]
cmdDetails
{
initCmd
:
cmdDetails
{
cannotRunOnDaemon
:
true
,
doesNotUseRepo
:
true
},
daemonCmd
:
cmdDetails
{
cannotRunOnDaemon
:
true
},
commandsClientCmd
:
cmdDetails
{
doesNotUseRepo
:
true
},
commands
.
CommandsDaemonCmd
:
cmdDetails
{
doesNotUseRepo
:
true
},
commands
.
DiagCmd
:
cmdDetails
{
cannotRunOnClient
:
true
},
commands
.
VersionCmd
:
cmdDetails
{
doesNotUseRepo
:
true
},
commands
.
UpdateCmd
:
cmdDetails
{
cannotRunOnDaemon
:
true
},
commands
.
LogCmd
:
cmdDetails
{
cannotRunOnClient
:
true
},
}
cmd/ipfs2/tour.go
浏览文件 @
bb8d4ebd
...
...
@@ -13,7 +13,7 @@ import (
tour
"github.com/jbenet/go-ipfs/tour"
)
var
cmdTour
=
&
cmds
.
Command
{
var
tourCmd
=
&
cmds
.
Command
{
Helptext
:
cmds
.
HelpText
{
Tagline
:
"An introduction to IPFS"
,
ShortDescription
:
`
...
...
core/commands2/bootstrap.go
浏览文件 @
bb8d4ebd
...
...
@@ -37,9 +37,9 @@ Running 'ipfs bootstrap' with no arguments will run 'ipfs bootstrap list'.
Type
:
bootstrapListCmd
.
Type
,
Subcommands
:
map
[
string
]
*
cmds
.
Command
{
"list"
:
bootstrapListCmd
,
"add"
:
bootstrapAddCmd
,
"rm"
:
bootstrapRemoveCmd
,
"list"
:
bootstrapListCmd
,
"add"
:
bootstrapAddCmd
,
"rm"
:
bootstrapRemoveCmd
,
},
}
...
...
core/commands2/diag.go
浏览文件 @
bb8d4ebd
...
...
@@ -28,7 +28,7 @@ type DiagnosticOutput struct {
Peers
[]
DiagnosticPeer
}
var
d
iagCmd
=
&
cmds
.
Command
{
var
D
iagCmd
=
&
cmds
.
Command
{
Helptext
:
cmds
.
HelpText
{
Tagline
:
"Generates diagnostic reports"
,
},
...
...
core/commands2/log.go
浏览文件 @
bb8d4ebd
...
...
@@ -13,7 +13,7 @@ import (
// we convert it at this step.
var
logAllKeyword
=
"all"
var
l
ogCmd
=
&
cmds
.
Command
{
var
L
ogCmd
=
&
cmds
.
Command
{
Helptext
:
cmds
.
HelpText
{
Tagline
:
"Change the logging level"
,
ShortDescription
:
`
...
...
core/commands2/root.go
浏览文件 @
bb8d4ebd
...
...
@@ -51,21 +51,24 @@ Plumbing commands:
},
}
// commandsDaemonCmd is the "ipfs commands" command for daemon
var
CommandsDaemonCmd
=
CommandsCmd
(
Root
)
var
rootSubcommands
=
map
[
string
]
*
cmds
.
Command
{
"cat"
:
catCmd
,
"ls"
:
lsCmd
,
"commands"
:
Commands
Cmd
(
Root
)
,
"commands"
:
Commands
DaemonCmd
,
"name"
:
nameCmd
,
"add"
:
addCmd
,
"log"
:
l
ogCmd
,
"diag"
:
d
iagCmd
,
"log"
:
L
ogCmd
,
"diag"
:
D
iagCmd
,
"pin"
:
pinCmd
,
"version"
:
v
ersionCmd
,
"version"
:
V
ersionCmd
,
"config"
:
configCmd
,
"bootstrap"
:
bootstrapCmd
,
"mount"
:
mountCmd
,
"block"
:
blockCmd
,
"update"
:
u
pdateCmd
,
"update"
:
U
pdateCmd
,
"object"
:
objectCmd
,
"refs"
:
refsCmd
,
}
...
...
core/commands2/update.go
浏览文件 @
bb8d4ebd
...
...
@@ -14,7 +14,7 @@ type UpdateOutput struct {
NewVersion
string
}
var
u
pdateCmd
=
&
cmds
.
Command
{
var
U
pdateCmd
=
&
cmds
.
Command
{
Helptext
:
cmds
.
HelpText
{
Tagline
:
"Downloads and installs updates for IPFS"
,
ShortDescription
:
"ipfs update is a utility command used to check for updates and apply them."
,
...
...
core/commands2/version.go
浏览文件 @
bb8d4ebd
...
...
@@ -9,7 +9,7 @@ type VersionOutput struct {
Version
string
}
var
v
ersionCmd
=
&
cmds
.
Command
{
var
V
ersionCmd
=
&
cmds
.
Command
{
Helptext
:
cmds
.
HelpText
{
Tagline
:
"Outputs the current version of IPFS"
,
ShortDescription
:
"Returns the version number of IPFS and exits."
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论