Commit 8cad2d2c authored by rht's avatar rht

Move 'tour' to core/commands

Side effect: this makes 'tour' accessible through the HTTP API
parent 4e71ce3c
......@@ -23,7 +23,6 @@ var commandsClientCmd = commands.CommandsCmd(Root)
var localCommands = map[string]*cmds.Command{
"daemon": daemonCmd,
"init": initCmd,
"tour": tourCmd,
"commands": commandsClientCmd,
}
var localMap = make(map[*cmds.Command]bool)
......
......@@ -101,6 +101,7 @@ var rootSubcommands = map[string]*cmds.Command{
"resolve": ResolveCmd,
"stats": StatsCmd,
"swarm": SwarmCmd,
"tour": tourCmd,
"update": UpdateCmd,
"version": VersionCmd,
"bitswap": BitswapCmd,
......
package main
package commands
import (
"bytes"
"fmt"
"html/template"
"io"
"os"
cmds "github.com/ipfs/go-ipfs/commands"
config "github.com/ipfs/go-ipfs/repo/config"
......@@ -50,7 +49,6 @@ func tourRunFunc(req cmds.Request, res cmds.Response) {
}
var w bytes.Buffer
defer w.WriteTo(os.Stdout)
t, err := tourGet(id)
if err != nil {
......@@ -64,11 +62,13 @@ func tourRunFunc(req cmds.Request, res cmds.Response) {
fmt.Fprintln(&w, err)
fmt.Fprintln(&w, "")
fprintTourList(&w, tour.TopicID(cfg.Tour.Last))
res.SetOutput(bytes.NewReader(w.Bytes()))
return
}
fprintTourShow(&w, t)
res.SetOutput(bytes.NewReader(w.Bytes()))
}
var cmdIpfsTourNext = &cmds.Command{
......@@ -106,7 +106,7 @@ var cmdIpfsTourNext = &cmds.Command{
}
}
w.WriteTo(os.Stdout)
res.SetOutput(bytes.NewReader(w.Bytes()))
},
}
......@@ -146,7 +146,7 @@ var cmdIpfsTourList = &cmds.Command{
var w bytes.Buffer
fprintTourList(&w, tour.TopicID(cfg.Tour.Last))
w.WriteTo(os.Stdout)
res.SetOutput(bytes.NewReader(w.Bytes()))
},
}
......
package main
package commands
import (
"bytes"
......
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