mirror of
https://github.com/kataras/iris.git
synced 2025-02-03 07:50:34 +01:00
31 lines
578 B
Go
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
|
||
|
}
|