Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
2dceb092
提交
2dceb092
authored
12月 12, 2018
作者:
Łukasz Magiera
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
commands: deprecate --local for --offline
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
上级
47a46393
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
21 行增加
和
10 行删除
+21
-10
daemon.go
cmd/ipfs/daemon.go
+1
-2
env.go
core/commands/cmdenv/env.go
+13
-3
root.go
core/commands/root.go
+7
-5
没有找到文件。
cmd/ipfs/daemon.go
浏览文件 @
2dceb092
...
...
@@ -40,7 +40,7 @@ const (
ipnsMountKwd
=
"mount-ipns"
migrateKwd
=
"migrate"
mountKwd
=
"mount"
offlineKwd
=
"offline"
offlineKwd
=
"offline"
// global option
routingOptionKwd
=
"routing"
routingOptionSupernodeKwd
=
"supernode"
routingOptionDHTClientKwd
=
"dhtclient"
...
...
@@ -161,7 +161,6 @@ Headers.
cmdkit
.
BoolOption
(
unencryptTransportKwd
,
"Disable transport encryption (for debugging protocols)"
),
cmdkit
.
BoolOption
(
enableGCKwd
,
"Enable automatic periodic repo garbage collection"
),
cmdkit
.
BoolOption
(
adjustFDLimitKwd
,
"Check and raise file descriptor limits if needed"
)
.
WithDefault
(
true
),
cmdkit
.
BoolOption
(
offlineKwd
,
"Run offline. Do not connect to the rest of the network but provide local API."
),
cmdkit
.
BoolOption
(
migrateKwd
,
"If true, assume yes at the migrate prompt. If false, assume no."
),
cmdkit
.
BoolOption
(
enablePubSubKwd
,
"Instantiate the ipfs daemon with the experimental pubsub feature enabled."
),
cmdkit
.
BoolOption
(
enableIPNSPubSubKwd
,
"Enable IPNS record distribution through pubsub; enables pubsub."
),
...
...
core/commands/cmdenv/env.go
浏览文件 @
2dceb092
...
...
@@ -2,6 +2,7 @@ package cmdenv
import
(
"fmt"
"strings"
"github.com/ipfs/go-ipfs/commands"
"github.com/ipfs/go-ipfs/core"
...
...
@@ -10,8 +11,11 @@ import (
config
"gx/ipfs/QmYyzmMnhNTtoXx5ttgUaRdHHckYnQWjPL98hgLAR2QLDD/go-ipfs-config"
cmds
"gx/ipfs/QmaAP56JAwdjwisPTu4yx17whcjTr6y5JCSCF77Y1rahWV/go-ipfs-cmds"
logging
"gx/ipfs/QmcuXC5cxs79ro2cUuHs4HQ2bkDLJUYokwL8aivcX6HW3C/go-log"
)
var
log
=
logging
.
Logger
(
"core/commands/cmdenv"
)
// GetNode extracts the node from the environment.
func
GetNode
(
env
interface
{})
(
*
core
.
IpfsNode
,
error
)
{
ctx
,
ok
:=
env
.
(
*
commands
.
Context
)
...
...
@@ -29,13 +33,19 @@ func GetApi(env cmds.Environment, req *cmds.Request) (coreiface.CoreAPI, error)
return
nil
,
fmt
.
Errorf
(
"expected env to be of type %T, got %T"
,
ctx
,
env
)
}
local
,
_
:=
req
.
Options
[
"local"
]
.
(
bool
)
offline
,
_
:=
req
.
Options
[
"offline"
]
.
(
bool
)
if
!
offline
{
offline
,
_
=
req
.
Options
[
"local"
]
.
(
bool
)
if
offline
{
log
.
Errorf
(
"Command '%s', --local is deprecated, use --offline instead"
,
strings
.
Join
(
req
.
Path
,
" "
))
}
}
api
,
err
:=
ctx
.
GetAPI
()
if
err
!=
nil
{
return
nil
,
err
}
if
local
{
return
api
.
WithOptions
(
options
.
Api
.
Offline
(
local
))
if
offline
{
return
api
.
WithOptions
(
options
.
Api
.
Offline
(
offline
))
}
return
api
,
nil
...
...
core/commands/root.go
浏览文件 @
2dceb092
...
...
@@ -18,10 +18,11 @@ var log = logging.Logger("core/commands")
var
ErrNotOnline
=
errors
.
New
(
"this command must be run in online mode. Try running 'ipfs daemon' first"
)
const
(
ConfigOption
=
"config"
DebugOption
=
"debug"
LocalOption
=
"local"
ApiOption
=
"api"
ConfigOption
=
"config"
DebugOption
=
"debug"
LocalOption
=
"local"
// DEPRECATED: use OfflineOption
OfflineOption
=
"offline"
ApiOption
=
"api"
)
var
Root
=
&
cmds
.
Command
{
...
...
@@ -92,7 +93,8 @@ The CLI will exit with one of the following values:
cmdkit
.
BoolOption
(
DebugOption
,
"D"
,
"Operate in debug mode."
),
cmdkit
.
BoolOption
(
cmds
.
OptLongHelp
,
"Show the full command help text."
),
cmdkit
.
BoolOption
(
cmds
.
OptShortHelp
,
"Show a short version of the command help text."
),
cmdkit
.
BoolOption
(
LocalOption
,
"L"
,
"Run the command locally, instead of using the daemon."
),
cmdkit
.
BoolOption
(
LocalOption
,
"L"
,
"Run the command locally, instead of using the daemon. DEPRECATED: use --offline."
),
cmdkit
.
BoolOption
(
OfflineOption
,
"O"
,
"Run the command offline."
),
cmdkit
.
StringOption
(
ApiOption
,
"Use a specific API instance (defaults to /ip4/127.0.0.1/tcp/5001)"
),
// global options, added to every command
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论