From 40c6ffd4feefe5055affede95dd2cbfc3df19916 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 19 Jun 2015 02:44:03 -0700 Subject: [PATCH] core/commands: Make IpnsCmd and PublishCmd public ipfs-shell [1] accesses the Command objects directly to construct requests for an external IPFS daemon API. This isn't a terribly robust approach, because it doesn't handle version differences between the version of go-ipfs used to build the daemon and the version used to build the ipfs-shell-consuming application. But for cases where you can get those APIs to match it works well. Making these two commands public allows us to write ipfs-shell wrappers for them. Until we figure out how to get ipfs-shell working without access to core/commands, I think the best approach is to make future command objects and their returned structures public, and to go back and expose existing commands/structures on an as-needed basis. In this case, I need the public PublishCmd for the Docker-registry storage driver, and I made the IpnsCmd public at the same time to stay consistent for both 'ipfs name ...' sub-commands. [1]: https://github.com/whyrusleeping/ipfs-shell License: MIT Signed-off-by: W. Trevor King --- core/commands/ipns.go | 2 +- core/commands/name.go | 4 ++-- core/commands/publish.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/commands/ipns.go b/core/commands/ipns.go index 76a455ef5..50bcd6304 100644 --- a/core/commands/ipns.go +++ b/core/commands/ipns.go @@ -10,7 +10,7 @@ import ( u "github.com/ipfs/go-ipfs/util" ) -var ipnsCmd = &cmds.Command{ +var IpnsCmd = &cmds.Command{ Helptext: cmds.HelpText{ Tagline: "Gets the value currently published at an IPNS name", ShortDescription: ` diff --git a/core/commands/name.go b/core/commands/name.go index a9b3faed7..974138104 100644 --- a/core/commands/name.go +++ b/core/commands/name.go @@ -51,7 +51,7 @@ Resolve the value of another name: }, Subcommands: map[string]*cmds.Command{ - "publish": publishCmd, - "resolve": ipnsCmd, + "publish": PublishCmd, + "resolve": IpnsCmd, }, } diff --git a/core/commands/publish.go b/core/commands/publish.go index 0bb7e93cf..b19b0f932 100644 --- a/core/commands/publish.go +++ b/core/commands/publish.go @@ -17,7 +17,7 @@ import ( var errNotOnline = errors.New("This command must be run in online mode. Try running 'ipfs daemon' first.") -var publishCmd = &cmds.Command{ +var PublishCmd = &cmds.Command{ Helptext: cmds.HelpText{ Tagline: "Publish an object to IPNS", ShortDescription: `