config

package
v0.0.0-...-faaa73c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapWithConfig

func WrapWithConfig(c *cli.Context, action func(*cli.Context, *Configuration) error) error

WrapWithConfig

Types

type Configuration

type Configuration struct {
	Title       string `json:"title" yaml:"title"`
	Description string `json:"description" yaml:"description"`
	Url         string `json:"url" yaml:"url"`
	FeedLimit   int    `json:"feedLimit" yaml:"feed_limit"`
	Author      string `json:"author" yaml:"author"`
	ServePort   int    `json:"servePort" yaml:"serve_port"`
	Paths       struct {
		Root      string `json:"root" yaml:"root"`
		Posts     string `json:"posts" yaml:"posts"`
		Authors   string `json:"authors" yaml:"authors"`
		Tags      string `json:"tags" yaml:"tags"`
		Templates string `json:"templates" yaml:"templates"`
		Files     string `json:"files" yaml:"files"`
	} `json:"paths" yaml:"paths"`
	Mappings []*Mapping `json:"mappings" yaml:"mappings"`
}

func New

func New(configPath string) (*Configuration, error)

New

func (*Configuration) Validate

func (c *Configuration) Validate() (*Configuration, error)

Validate

type Mapping

type Mapping struct {
	Type     TemplateMapType `json:"type" yaml:"type"`
	Pattern  string          `json:"pattern" yaml:"pattern"`
	Input    string          `json:"input" yaml:"input"`
	Output   string          `json:"output" yaml:"output"`
	Partials []string        `json:"partials" yaml:"partials"`
}

type TemplateMapType

type TemplateMapType string
const (
	Tag    TemplateMapType = "tag"
	Post   TemplateMapType = "post"
	Author TemplateMapType = "author"
	Page   TemplateMapType = "page"
	Index  TemplateMapType = "index"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL