2013-12-03 06:50:02 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2014-12-25 01:53:48 +08:00
|
|
|
"io/ioutil"
|
2013-12-03 06:50:02 +08:00
|
|
|
"os"
|
2014-06-10 10:59:59 +08:00
|
|
|
"strings"
|
2013-12-03 06:50:02 +08:00
|
|
|
"text/template"
|
2014-07-13 00:49:18 +08:00
|
|
|
|
|
|
|
"github.com/codegangsta/cli"
|
2013-12-03 06:50:02 +08:00
|
|
|
)
|
|
|
|
|
2014-12-25 03:25:02 +08:00
|
|
|
type config struct {
|
2014-12-25 03:58:41 +08:00
|
|
|
Package string
|
2014-06-10 10:59:59 +08:00
|
|
|
Name string
|
|
|
|
UpperName string
|
|
|
|
FirstLetter string
|
2014-12-25 03:25:02 +08:00
|
|
|
Example string
|
|
|
|
dir string
|
2013-12-03 06:50:02 +08:00
|
|
|
}
|
|
|
|
|
2014-06-10 10:59:59 +08:00
|
|
|
func Generate() cli.Command {
|
|
|
|
return cli.Command{
|
|
|
|
Name: "generate",
|
2016-10-08 16:33:04 +08:00
|
|
|
Usage: "Generate new Gobot adaptors, drivers, and platforms",
|
2014-06-10 10:59:59 +08:00
|
|
|
Action: func(c *cli.Context) {
|
2014-12-25 03:25:02 +08:00
|
|
|
valid := false
|
2016-10-08 16:33:04 +08:00
|
|
|
for _, s := range []string{"adaptor", "driver", "platform"} {
|
2014-12-25 03:25:02 +08:00
|
|
|
if s == c.Args().First() {
|
|
|
|
valid = true
|
|
|
|
}
|
2014-06-10 10:59:59 +08:00
|
|
|
}
|
2014-12-25 03:25:02 +08:00
|
|
|
if valid == false {
|
|
|
|
fmt.Println("Invalid/no subcommand supplied.\n")
|
|
|
|
fmt.Println("Usage:")
|
2014-12-25 03:58:41 +08:00
|
|
|
fmt.Println(" gobot generate adaptor <name> [package] # generate a new Gobot adaptor")
|
|
|
|
fmt.Println(" gobot generate driver <name> [package] # generate a new Gobot driver")
|
2016-10-08 16:33:04 +08:00
|
|
|
fmt.Println(" gobot generate platform <name> [package] # generate a new Gobot platform")
|
2014-12-25 03:25:02 +08:00
|
|
|
return
|
2014-06-10 10:59:59 +08:00
|
|
|
}
|
|
|
|
|
2014-12-25 03:58:41 +08:00
|
|
|
if len(c.Args()) < 2 {
|
2014-12-25 03:25:02 +08:00
|
|
|
fmt.Println("Please provide a one word name.")
|
|
|
|
return
|
2014-12-25 01:53:48 +08:00
|
|
|
}
|
|
|
|
|
2014-12-25 03:25:02 +08:00
|
|
|
name := strings.ToLower(c.Args()[1])
|
2014-12-25 03:58:41 +08:00
|
|
|
packageName := name
|
|
|
|
if len(c.Args()) > 2 {
|
|
|
|
packageName = strings.ToLower(c.Args()[2])
|
|
|
|
}
|
2014-12-25 03:25:02 +08:00
|
|
|
upperName := strings.ToUpper(string(name[0])) + string(name[1:])
|
2014-06-10 10:59:59 +08:00
|
|
|
|
2014-12-25 03:25:02 +08:00
|
|
|
cfg := config{
|
2014-12-25 03:58:41 +08:00
|
|
|
Package: packageName,
|
2014-07-13 00:49:18 +08:00
|
|
|
UpperName: upperName,
|
2014-12-25 03:25:02 +08:00
|
|
|
Name: name,
|
|
|
|
FirstLetter: string(name[0]),
|
|
|
|
dir: ".",
|
2014-12-25 01:53:48 +08:00
|
|
|
}
|
|
|
|
|
2014-12-25 03:25:02 +08:00
|
|
|
switch c.Args().First() {
|
|
|
|
case "adaptor":
|
|
|
|
if err := generateAdaptor(cfg); err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
}
|
|
|
|
case "driver":
|
|
|
|
if err := generateDriver(cfg); err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
}
|
2016-10-08 16:33:04 +08:00
|
|
|
case "platform":
|
2014-12-25 03:25:02 +08:00
|
|
|
pwd, err := os.Getwd()
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
return
|
|
|
|
}
|
2016-10-08 16:26:29 +08:00
|
|
|
dir := pwd + "/" + cfg.Name
|
2014-12-25 03:25:02 +08:00
|
|
|
fmt.Println("Creating", dir)
|
|
|
|
if err := os.MkdirAll(dir, 0700); err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
cfg.dir = dir
|
|
|
|
|
|
|
|
examplesDir := dir + "/examples"
|
|
|
|
fmt.Println("Creating", examplesDir)
|
|
|
|
if err := os.MkdirAll(examplesDir, 0700); err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2016-10-08 16:33:04 +08:00
|
|
|
if err := generatePlatform(cfg); err != nil {
|
2014-12-25 03:25:02 +08:00
|
|
|
fmt.Println(err)
|
|
|
|
}
|
2014-12-25 01:53:48 +08:00
|
|
|
}
|
2014-06-10 10:59:59 +08:00
|
|
|
},
|
2014-02-25 12:18:12 +08:00
|
|
|
}
|
2013-12-03 06:50:02 +08:00
|
|
|
}
|
|
|
|
|
2014-12-25 03:25:02 +08:00
|
|
|
func generate(c config, file string, tmpl string) error {
|
|
|
|
fileLocation := c.dir + "/" + file
|
|
|
|
fmt.Println("Creating", fileLocation)
|
|
|
|
|
|
|
|
f, err := os.Create(fileLocation)
|
|
|
|
defer f.Close()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
t, err := template.New("").Parse(tmpl)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return t.Execute(f, c)
|
|
|
|
}
|
|
|
|
|
|
|
|
func generateDriver(c config) error {
|
|
|
|
if err := generate(c, c.Name+"_driver.go", driver()); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2014-12-25 03:58:41 +08:00
|
|
|
return generate(c, c.Name+"_driver_test.go", driverTest())
|
2014-12-25 03:25:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func generateAdaptor(c config) error {
|
|
|
|
if err := generate(c, c.Name+"_adaptor.go", adaptor()); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return generate(c, c.Name+"_adaptor_test.go", adaptorTest())
|
|
|
|
}
|
|
|
|
|
2016-10-08 16:33:04 +08:00
|
|
|
func generatePlatform(c config) error {
|
2014-12-25 03:25:02 +08:00
|
|
|
if err := generateDriver(c); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if err := generateAdaptor(c); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
dir := c.dir
|
|
|
|
exampleDir := dir + "/examples"
|
|
|
|
c.dir = exampleDir
|
|
|
|
|
2014-12-25 03:58:41 +08:00
|
|
|
if err := generate(c, "main.go", example()); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2014-12-25 03:25:02 +08:00
|
|
|
|
|
|
|
c.dir = dir
|
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
if exp, err := ioutil.ReadFile(exampleDir + "/main.go"); err != nil {
|
2014-12-25 03:25:02 +08:00
|
|
|
return err
|
|
|
|
} else {
|
2016-10-08 16:26:29 +08:00
|
|
|
c.Example = string(exp)
|
2014-12-25 03:25:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return generate(c, "README.md", readme())
|
|
|
|
}
|
|
|
|
|
2013-12-03 06:50:02 +08:00
|
|
|
func adaptor() string {
|
2014-12-25 03:58:41 +08:00
|
|
|
return `package {{.Package}}
|
2013-12-03 06:50:02 +08:00
|
|
|
|
2014-12-25 01:53:48 +08:00
|
|
|
type {{.UpperName}}Adaptor struct {
|
|
|
|
name string
|
2014-02-25 12:18:12 +08:00
|
|
|
}
|
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
func New{{.UpperName}}Adaptor() *{{.UpperName}}Adaptor {
|
2014-12-25 01:53:48 +08:00
|
|
|
return &{{.UpperName}}Adaptor{
|
2016-10-08 16:26:29 +08:00
|
|
|
name: "{{.UpperName}}",
|
2014-12-25 01:53:48 +08:00
|
|
|
}
|
2014-02-25 12:18:12 +08:00
|
|
|
}
|
|
|
|
|
2014-12-25 01:53:48 +08:00
|
|
|
func ({{.FirstLetter}} *{{.UpperName}}Adaptor) Name() string { return {{.FirstLetter}}.name }
|
2013-12-03 06:50:02 +08:00
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
func ({{.FirstLetter}} *{{.UpperName}}Adaptor) SetName(name string) { {{.FirstLetter}}.name = name }
|
|
|
|
|
2016-11-07 21:55:21 +08:00
|
|
|
func ({{.FirstLetter}} *{{.UpperName}}Adaptor) Connect() error { return nil }
|
2014-12-25 01:53:48 +08:00
|
|
|
|
2016-11-07 21:55:21 +08:00
|
|
|
func ({{.FirstLetter}} *{{.UpperName}}Adaptor) Finalize() error { return nil }
|
2014-12-25 01:53:48 +08:00
|
|
|
|
|
|
|
func ({{.FirstLetter}} *{{.UpperName}}Adaptor) Ping() string { return "pong" }
|
2013-12-03 06:50:02 +08:00
|
|
|
`
|
|
|
|
}
|
|
|
|
|
|
|
|
func driver() string {
|
2014-12-25 03:58:41 +08:00
|
|
|
return `package {{.Package}}
|
2013-12-03 06:50:02 +08:00
|
|
|
|
|
|
|
import (
|
2014-12-25 01:53:48 +08:00
|
|
|
"time"
|
|
|
|
|
2016-12-08 20:24:03 +08:00
|
|
|
"gobot.io/x/gobot"
|
2013-12-03 06:50:02 +08:00
|
|
|
)
|
|
|
|
|
2014-12-25 01:53:48 +08:00
|
|
|
const Hello string = "hello"
|
2013-12-03 06:50:02 +08:00
|
|
|
|
2014-12-25 01:53:48 +08:00
|
|
|
type {{.UpperName}}Driver struct {
|
|
|
|
name string
|
|
|
|
connection gobot.Connection
|
|
|
|
interval time.Duration
|
|
|
|
halt chan bool
|
|
|
|
gobot.Eventer
|
|
|
|
gobot.Commander
|
2014-02-25 12:18:12 +08:00
|
|
|
}
|
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
func New{{.UpperName}}Driver(a *{{.UpperName}}Adaptor) *{{.UpperName}}Driver {
|
2014-12-25 01:53:48 +08:00
|
|
|
{{.FirstLetter}} := &{{.UpperName}}Driver{
|
2016-10-08 16:26:29 +08:00
|
|
|
name: "{{.UpperName}}",
|
2014-12-25 01:53:48 +08:00
|
|
|
connection: a,
|
|
|
|
interval: 500*time.Millisecond,
|
|
|
|
halt: make(chan bool, 0),
|
|
|
|
Eventer: gobot.NewEventer(),
|
|
|
|
Commander: gobot.NewCommander(),
|
|
|
|
}
|
|
|
|
|
|
|
|
{{.FirstLetter}}.AddEvent(Hello)
|
|
|
|
|
|
|
|
{{.FirstLetter}}.AddCommand(Hello, func(params map[string]interface{}) interface{} {
|
|
|
|
return {{.FirstLetter}}.Hello()
|
|
|
|
})
|
|
|
|
|
|
|
|
return {{.FirstLetter}}
|
|
|
|
}
|
|
|
|
|
|
|
|
func ({{.FirstLetter}} *{{.UpperName}}Driver) Name() string { return {{.FirstLetter}}.name }
|
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
func ({{.FirstLetter}} *{{.UpperName}}Driver) SetName(name string) { {{.FirstLetter}}.name = name }
|
|
|
|
|
2014-12-25 01:53:48 +08:00
|
|
|
func ({{.FirstLetter}} *{{.UpperName}}Driver) Connection() gobot.Connection {
|
|
|
|
return {{.FirstLetter}}.connection
|
|
|
|
}
|
|
|
|
|
|
|
|
func ({{.FirstLetter}} *{{.UpperName}}Driver) adaptor() *{{.UpperName}}Adaptor {
|
|
|
|
return {{.FirstLetter}}.Connection().(*{{.UpperName}}Adaptor)
|
2013-12-03 06:50:02 +08:00
|
|
|
}
|
|
|
|
|
2014-12-25 01:53:48 +08:00
|
|
|
func ({{.FirstLetter}} *{{.UpperName}}Driver) Hello() string {
|
|
|
|
return "hello from " + {{.FirstLetter}}.Name() + "!"
|
|
|
|
}
|
|
|
|
|
|
|
|
func ({{.FirstLetter}} *{{.UpperName}}Driver) Ping() string {
|
|
|
|
return {{.FirstLetter}}.adaptor().Ping()
|
|
|
|
}
|
|
|
|
|
2016-11-07 21:55:21 +08:00
|
|
|
func ({{.FirstLetter}} *{{.UpperName}}Driver) Start() error {
|
2014-12-25 01:53:48 +08:00
|
|
|
go func() {
|
|
|
|
for {
|
2016-10-08 16:26:29 +08:00
|
|
|
{{.FirstLetter}}.Publish({{.FirstLetter}}.Event(Hello), {{.FirstLetter}}.Hello())
|
2014-12-25 01:53:48 +08:00
|
|
|
|
|
|
|
select {
|
|
|
|
case <- time.After({{.FirstLetter}}.interval):
|
|
|
|
case <- {{.FirstLetter}}.halt:
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2016-11-07 21:55:21 +08:00
|
|
|
func ({{.FirstLetter}} *{{.UpperName}}Driver) Halt() error {
|
2014-12-25 01:53:48 +08:00
|
|
|
{{.FirstLetter}}.halt <- true
|
|
|
|
return nil
|
2014-06-16 08:27:51 +08:00
|
|
|
}
|
|
|
|
|
2014-04-02 10:20:38 +08:00
|
|
|
`
|
|
|
|
}
|
|
|
|
|
2014-12-25 01:53:48 +08:00
|
|
|
func example() string {
|
|
|
|
return `
|
|
|
|
package main
|
2014-04-02 10:20:38 +08:00
|
|
|
|
|
|
|
import (
|
2014-12-25 01:53:48 +08:00
|
|
|
"../"
|
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
|
2016-12-08 20:24:03 +08:00
|
|
|
"gobot.io/x/gobot"
|
2014-04-02 10:20:38 +08:00
|
|
|
)
|
|
|
|
|
2014-12-25 01:53:48 +08:00
|
|
|
func main() {
|
2016-10-16 02:02:54 +08:00
|
|
|
gbot := gobot.NewMaster()
|
2014-04-02 10:20:38 +08:00
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
conn := {{.Package}}.New{{.UpperName}}Adaptor()
|
|
|
|
dev := {{.Package}}.New{{.UpperName}}Driver(conn)
|
2014-12-25 01:53:48 +08:00
|
|
|
|
|
|
|
work := func() {
|
2016-10-08 16:26:29 +08:00
|
|
|
dev.On(dev.Event({{.Package}}.Hello), func(data interface{}) {
|
2014-12-25 01:53:48 +08:00
|
|
|
fmt.Println(data)
|
|
|
|
})
|
|
|
|
|
|
|
|
gobot.Every(1200*time.Millisecond, func() {
|
|
|
|
fmt.Println(dev.Ping())
|
|
|
|
})
|
|
|
|
}
|
2014-04-02 10:20:38 +08:00
|
|
|
|
2014-12-25 01:53:48 +08:00
|
|
|
robot := gobot.NewRobot(
|
|
|
|
"robot",
|
|
|
|
[]gobot.Connection{conn},
|
|
|
|
[]gobot.Device{dev},
|
|
|
|
work,
|
|
|
|
)
|
|
|
|
|
|
|
|
gbot.AddRobot(robot)
|
|
|
|
gbot.Start()
|
2014-06-14 06:09:04 +08:00
|
|
|
}
|
2014-04-02 10:20:38 +08:00
|
|
|
`
|
2013-12-03 06:50:02 +08:00
|
|
|
}
|
|
|
|
|
2014-12-25 01:53:48 +08:00
|
|
|
func driverTest() string {
|
2014-12-25 03:58:41 +08:00
|
|
|
return `package {{.Package}}
|
2014-04-02 10:20:38 +08:00
|
|
|
|
|
|
|
import (
|
2014-12-25 01:53:48 +08:00
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
2016-12-08 20:24:03 +08:00
|
|
|
"gobot.io/x/gobot"
|
|
|
|
"gobot.io/x/gobot/gobottest"
|
2014-04-02 10:20:38 +08:00
|
|
|
)
|
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
var _ gobot.Driver = (*{{.UpperName}}Driver)(nil)
|
|
|
|
|
2014-12-25 01:53:48 +08:00
|
|
|
func Test{{.UpperName}}Driver(t *testing.T) {
|
2016-10-08 16:26:29 +08:00
|
|
|
d := New{{.UpperName}}Driver(New{{.UpperName}}Adaptor())
|
2014-12-25 01:53:48 +08:00
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
gobottest.Assert(t, d.Name(), "{{.UpperName}}")
|
|
|
|
gobottest.Assert(t, d.Connection().Name(), "{{.UpperName}}")
|
2014-12-25 01:53:48 +08:00
|
|
|
|
|
|
|
ret := d.Command(Hello)(nil)
|
2016-10-08 16:26:29 +08:00
|
|
|
gobottest.Assert(t, ret.(string), "hello from {{.UpperName}}!")
|
2014-12-25 01:53:48 +08:00
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
gobottest.Assert(t, d.Ping(), "pong")
|
2014-12-25 01:53:48 +08:00
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
gobottest.Assert(t, len(d.Start()), 0)
|
2014-12-25 01:53:48 +08:00
|
|
|
|
2016-11-05 20:05:49 +08:00
|
|
|
time.Sleep(d.interval)
|
2014-12-25 01:53:48 +08:00
|
|
|
|
|
|
|
sem := make(chan bool, 0)
|
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
d.On(d.Event(Hello), func(data interface{}) {
|
2014-12-25 01:53:48 +08:00
|
|
|
sem <- true
|
|
|
|
})
|
|
|
|
|
|
|
|
select {
|
|
|
|
case <-sem:
|
|
|
|
case <-time.After(600 * time.Millisecond):
|
|
|
|
t.Errorf("Hello Event was not published")
|
|
|
|
}
|
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
gobottest.Assert(t, len(d.Halt()), 0)
|
2014-12-25 01:53:48 +08:00
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
d.On(d.Event(Hello), func(data interface{}) {
|
2014-12-25 01:53:48 +08:00
|
|
|
sem <- true
|
|
|
|
})
|
|
|
|
|
|
|
|
select {
|
|
|
|
case <-sem:
|
|
|
|
t.Errorf("Hello Event should not publish after Halt")
|
|
|
|
case <-time.After(600 * time.Millisecond):
|
|
|
|
}
|
2014-06-14 06:09:04 +08:00
|
|
|
}
|
|
|
|
|
2014-12-25 01:53:48 +08:00
|
|
|
`
|
2014-06-14 06:09:04 +08:00
|
|
|
}
|
|
|
|
|
2014-12-25 01:53:48 +08:00
|
|
|
func adaptorTest() string {
|
2014-12-25 03:58:41 +08:00
|
|
|
return `package {{.Package}}
|
2014-12-25 01:53:48 +08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2016-12-08 20:24:03 +08:00
|
|
|
"gobot.io/x/gobot"
|
|
|
|
"gobot.io/x/gobot/gobottest"
|
2014-12-25 01:53:48 +08:00
|
|
|
)
|
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
var _ gobot.Adaptor = (*{{.UpperName}}Adaptor)(nil)
|
|
|
|
|
2014-12-25 01:53:48 +08:00
|
|
|
func Test{{.UpperName}}Adaptor(t *testing.T) {
|
2016-10-08 16:26:29 +08:00
|
|
|
a := New{{.UpperName}}Adaptor()
|
2014-12-25 01:53:48 +08:00
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
gobottest.Assert(t, a.Name(), "{{.UpperName}}")
|
2014-12-25 01:53:48 +08:00
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
gobottest.Assert(t, len(a.Connect()), 0)
|
2014-12-25 01:53:48 +08:00
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
gobottest.Assert(t, a.Ping(), "pong")
|
2014-12-25 01:53:48 +08:00
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
gobottest.Assert(t, len(a.Connect()), 0)
|
2014-12-25 01:53:48 +08:00
|
|
|
|
2016-10-08 16:26:29 +08:00
|
|
|
gobottest.Assert(t, len(a.Finalize()), 0)
|
2013-12-03 06:50:02 +08:00
|
|
|
}
|
|
|
|
`
|
|
|
|
}
|
2014-02-25 12:18:12 +08:00
|
|
|
|
|
|
|
func readme() string {
|
2014-12-25 03:58:41 +08:00
|
|
|
return `# {{.Package}}
|
2014-02-25 12:18:12 +08:00
|
|
|
|
2014-06-10 10:59:59 +08:00
|
|
|
Gobot (http://gobot.io/) is a framework for robotics and physical computing using Go
|
2014-02-25 12:18:12 +08:00
|
|
|
|
2014-12-25 03:58:41 +08:00
|
|
|
This repository contains the Gobot adaptor and driver for {{.Package}}.
|
2014-02-25 12:18:12 +08:00
|
|
|
|
|
|
|
For more information about Gobot, check out the github repo at
|
2016-12-08 20:24:03 +08:00
|
|
|
https://gobot.io/x/gobot
|
2014-02-25 12:18:12 +08:00
|
|
|
|
|
|
|
## Installing
|
2014-12-25 03:58:41 +08:00
|
|
|
` + "```bash\ngo get path/to/repo/{{.Package}}\n```" + `
|
2014-02-25 12:18:12 +08:00
|
|
|
|
|
|
|
## Using
|
2014-12-25 01:53:48 +08:00
|
|
|
` + "```go{{.Example}}\n```" + `
|
2014-02-25 12:18:12 +08:00
|
|
|
|
|
|
|
## Connecting
|
|
|
|
|
2014-12-25 01:53:48 +08:00
|
|
|
Explain how to connect to the device here...
|
2014-02-25 12:18:12 +08:00
|
|
|
|
|
|
|
## License
|
|
|
|
|
2017-01-03 05:25:17 +08:00
|
|
|
Copyright (c) 2017 <Your Name Here>. Licensed under the <Insert license here> license.
|
2014-02-25 12:18:12 +08:00
|
|
|
`
|
|
|
|
}
|