Commit af65eec2 authored by Matt Bell's avatar Matt Bell Committed by Juan Batiz-Benet

core/commands2: Output error when trying to run 'publish' or 'resolve' in offline mode

parent 51c6a1c5
......@@ -20,6 +20,8 @@ type ResolveOutput struct {
Entries []IpnsEntry
}
var errNotOnline = errors.New("This command must be run in online mode. Try running 'ipfs daemon' first.")
var nameCmd = &cmds.Command{
Help: "TODO",
Subcommands: map[string]*cmds.Command{
......@@ -38,6 +40,11 @@ var publishCmd = &cmds.Command{
n := req.Context().Node
args := req.Arguments()
if n.Network == nil {
res.SetError(errNotOnline, cmds.ErrNormal)
return
}
if n.Identity == nil {
res.SetError(errors.New("Identity not loaded!"), cmds.ErrNormal)
return
......@@ -86,6 +93,11 @@ var resolveCmd = &cmds.Command{
n := req.Context().Node
var names []string
if n.Network == nil {
res.SetError(errNotOnline, cmds.ErrNormal)
return
}
if len(req.Arguments()) == 0 {
if n.Identity == nil {
res.SetError(errors.New("Identity not loaded!"), cmds.ErrNormal)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment