open-golang/readme-template/package.txt

112 lines
2.3 KiB
Plaintext

{{with .PAst}}{{node $ .}}{{end}}{{/*
---------------------------------------
*/}}{{with .PDoc}}{{if $.IsMain}}COMMAND DOCUMENTATION
{{comment_text .Doc " " "\t"}}
{{else}}# {{.Name}}
## Description ##
{{comment_text .Doc " " "\t"}}
## Documentation ##
[http://godoc.org/{{.ImportPath}}](http://godoc.org/{{.ImportPath}})
## Import ##
import "{{.ImportPath}}"
## Usage ##
### open google.com in the user's default browser (method 1):
open.Run("https://google.com/")
### open google.com in the user's default browser (method 2):
open.Start("https://google.com")
### you can listen for errors
err := open.Run("https://google.com/")
### you can specify the program to use
open.RunWith("https://google.com/", "firefox")
{{example_text $ "" " "}}{{/*
---------------------------------------
*/}}{{with .Consts}}
CONSTANTS
{{range .}}{{node $ .Decl}}
{{comment_text .Doc " " "\t"}}
{{end}}{{end}}{{/*
---------------------------------------
*/}}{{with .Vars}}
VARIABLES
{{range .}}{{node $ .Decl}}
{{comment_text .Doc " " "\t"}}
{{end}}{{end}}{{/*
---------------------------------------
*/}}{{with .Funcs}}
## Functions ##
{{range .}}### {{node $ .Decl}}
{{comment_text .Doc " " "\t"}}
{{example_text $ .Name " "}}{{end}}{{end}}{{/*
---------------------------------------
*/}}{{with .Types}}
TYPES
{{range .}}{{$tname := .Name}}{{node $ .Decl}}
{{comment_text .Doc " " "\t"}}
{{range .Consts}}{{node $ .Decl}}
{{comment_text .Doc " " "\t"}}
{{end}}{{range .Vars}}{{node $ .Decl}}
{{comment_text .Doc " " "\t"}}
{{end}}{{example_text $ .Name " "}}
{{range .Funcs}}{{node $ .Decl}}
{{comment_text .Doc " " "\t"}}
{{example_text $ .Name " "}}
{{end}}{{range .Methods}}{{node $ .Decl}}
{{comment_text .Doc " " "\t"}}
{{$name := printf "%s_%s" $tname .Name}}{{example_text $ $name " "}}{{end}}
{{end}}{{end}}{{end}}{{/*
---------------------------------------
*/}}{{with $.Notes}}
{{range $marker, $content := .}}
{{$marker}}S
{{range $content}}{{comment_text .Body " " "\t"}}
{{end}}{{end}}{{end}}{{end}}{{/*
---------------------------------------
*/}}{{with .Dirs}}
SUBDIRECTORIES
{{if $.DirFlat}}{{range .List}}{{if .HasPkg}}
{{.Path}}{{end}}{{end}}
{{else}}{{range .List}}
{{repeat `. ` .Depth}}{{.Name}}{{end}}
{{end}}{{end}}
## License ##
Copyright (c) 2013 skratchdot
Licensed under the MIT license.