mirror of
https://github.com/kataras/iris.git
synced 2026-01-26 21:35:56 +00:00
7.0.1 - https://github.com/iris-contrib/community-board/issues/1 https://github.com/iris-contrib/community-board/issues/2
Read HISTORY.md Former-commit-id: 82df2d266055818ffafe0ba66b58cf4ed9089922
This commit is contained in:
30
internal/cmd/gen/website/recipe/recipe.go
Normal file
30
internal/cmd/gen/website/recipe/recipe.go
Normal file
@@ -0,0 +1,30 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user