iris/internal/cmd/gen/website/recipe/recipe.go
2017-06-07 07:20:53 +03:00

31 lines
578 B
Go

package recipe
import (
"github.com/kataras/iris/internal/cmd/gen/website/recipe/example"
)
type Recipe struct {
Branch string // i.e "master", "v6"...
Examples []example.Example
}
// NewRecipe accepts the "branch", i.e: "master", "v6", "v7"...
// and returns a new Recipe pointer with its generated and parsed examples.
func NewRecipe(branch string) (*Recipe, error) {
if branch == "" {
branch = "master"
}
examples, err := example.Parse(branch)
if err != nil {
return nil, err
}
r := &Recipe{
Branch: branch,
Examples: examples,
}
return r, nil
}