packagecommandsimport("errors""fmt""io""github.com/jbenet/go-ipfs/core"u"github.com/jbenet/go-ipfs/util""github.com/op/go-logging"nsys"github.com/jbenet/go-ipfs/namesys")varlog=logging.MustGetLogger("commands")funcPublish(n*core.IpfsNode,args[]string,optsmap[string]interface{},outio.Writer)error{log.Debug("Begin Publish")ifn.Identity==nil{returnerrors.New("Identity not loaded!")}k:=n.Identity.PrivKeyval:=u.Key(args[0])pub:=nsys.NewPublisher(n.DAG,n.Routing)err:=pub.Publish(k,val)iferr!=nil{returnerr}hash,err:=k.GetPublic().Hash()iferr!=nil{returnerr}fmt.Fprintf(out,"Published %s to %s\n",val,u.Key(hash).Pretty())returnnil}