提交 8d57f507 作者: Brian Tiger Chow

feat(tour) add file basics

keep things in one file for now
上级 8f6d6653
package tour
import (
"sort"
c "github.com/jbenet/go-ipfs/tour/content"
)
import "sort"
func init() {
for _, t := range allTopics {
......@@ -17,16 +13,67 @@ func init() {
// Topics contains a mapping of Tour Topic ID to Topic
var allTopics = []Topic{
Topic{
ID: ID("0.0"),
Content: c.IntroHelloMars,
},
Topic{
ID: ID("0.1"),
Content: c.IntroTour,
},
Topic{
ID: ID("0.2"),
Content: c.IntroAboutIpfs,
},
Topic{ID: ID("0.0"), Content: IntroHelloMars},
Topic{ID: ID("0.1"), Content: IntroTour},
Topic{ID: ID("0.2"), Content: IntroAboutIpfs},
// File Basics
Topic{ID: ID("X.0"), Content: FileBasicsFilesystem},
Topic{ID: ID("X.1"), Content: FileBasicsGetting},
Topic{ID: ID("X.2"), Content: FileBasicsAdding},
Topic{ID: ID("X.3"), Content: FileBasicsDirectories},
Topic{ID: ID("X.3"), Content: FileBasicsDirectories},
Topic{ID: ID("X.4"), Content: FileBasicsMounting},
Topic{ID: ID("X.2"), Content: FileBasicsAdding},
}
// Introduction
var IntroHelloMars = Content{
Title: "Hello Mars",
Text: `
check things work
`,
}
var IntroTour = Content{
Title: "Hello Mars",
Text: `
how this works
`,
}
var IntroAboutIpfs = Content{
Title: "About IPFS",
}
// File Basics
var FileBasicsFilesystem = Content{
Title: "Filesystem",
Text: `
`,
}
var FileBasicsGetting = Content{
Title: "Getting Files",
Text: `ipfs cat
`,
}
var FileBasicsAdding = Content{
Title: "Adding Files",
Text: `ipfs add
`,
}
var FileBasicsDirectories = Content{
Title: "Directories",
Text: `ipfs ls
`,
}
var FileBasicsDistributed = Content{
Title: "Distributed",
Text: `ipfs cat from mars
`,
}
var FileBasicsMounting = Content{
Title: "Getting Files",
Text: `ipfs mount (simple)
`,
}
package content
type Content struct {
Title string
Text string
}
package content
var IntroHelloMars = Content{
Title: "Hello Mars",
Text: `
check things work
`,
}
var IntroTour = Content{
Title: "Hello Mars",
Text: `
how this works
`,
}
var IntroAboutIpfs = Content{
Title: "About IPFS",
}
......@@ -4,7 +4,6 @@ import (
"strconv"
"strings"
content "github.com/jbenet/go-ipfs/tour/content"
u "github.com/jbenet/go-ipfs/util"
)
......@@ -28,7 +27,12 @@ func (a IDSlice) Less(i, j int) bool { return a[i].LessThan(a[j]) }
// Topic is a type of objects that structures a tour topic.
type Topic struct {
ID ID
content.Content
Content
}
type Content struct {
Title string
Text string
}
// Topics is a sorted list of topic IDs
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论