提交 8d57f507 作者: Brian Tiger Chow

feat(tour) add file basics

keep things in one file for now
上级 8f6d6653
package tour package tour
import ( import "sort"
"sort"
c "github.com/jbenet/go-ipfs/tour/content"
)
func init() { func init() {
for _, t := range allTopics { for _, t := range allTopics {
...@@ -17,16 +13,67 @@ func init() { ...@@ -17,16 +13,67 @@ func init() {
// Topics contains a mapping of Tour Topic ID to Topic // Topics contains a mapping of Tour Topic ID to Topic
var allTopics = []Topic{ var allTopics = []Topic{
Topic{ Topic{ID: ID("0.0"), Content: IntroHelloMars},
ID: ID("0.0"), Topic{ID: ID("0.1"), Content: IntroTour},
Content: c.IntroHelloMars, Topic{ID: ID("0.2"), Content: IntroAboutIpfs},
},
Topic{ // File Basics
ID: ID("0.1"), Topic{ID: ID("X.0"), Content: FileBasicsFilesystem},
Content: c.IntroTour, Topic{ID: ID("X.1"), Content: FileBasicsGetting},
}, Topic{ID: ID("X.2"), Content: FileBasicsAdding},
Topic{ Topic{ID: ID("X.3"), Content: FileBasicsDirectories},
ID: ID("0.2"), Topic{ID: ID("X.3"), Content: FileBasicsDirectories},
Content: c.IntroAboutIpfs, 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 ( ...@@ -4,7 +4,6 @@ import (
"strconv" "strconv"
"strings" "strings"
content "github.com/jbenet/go-ipfs/tour/content"
u "github.com/jbenet/go-ipfs/util" 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]) } ...@@ -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. // Topic is a type of objects that structures a tour topic.
type Topic struct { type Topic struct {
ID ID ID ID
content.Content Content
}
type Content struct {
Title string
Text string
} }
// Topics is a sorted list of topic IDs // Topics is a sorted list of topic IDs
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论