manifest

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package manifest provides structures and primitives to define apps.

Index

Constants

View Source
const (
	// Our longest app name to date. This can be updated, but it will need to
	// be tested in the mobile app.
	MaxNameLength = 17

	// Our longest app summary to date. This can be updated, but it will need to
	// be tested in the mobile app.
	MaxSummaryLength = 27
)
View Source
const ManifestFileName = "manifest.yaml"

Variables

This section is empty.

Functions

func GenerateDirName added in v0.32.0

func GenerateDirName(name string) string

GenerateDirName creates a suitable directory name from an app name.

func GenerateFileName

func GenerateFileName(name string) string

GenerateFileName creates a suitable file name for the starlark source.

func GenerateID

func GenerateID(name string) string

GenerateID creates a suitable ID from an app name.

func ValidateAuthor

func ValidateAuthor(author string) error

ValidateAuthor ensures the app author provided adheres to the standards for app author. We're picky here because these will display in the Tidbyt mobile app and need to display properly.

func ValidateDesc

func ValidateDesc(desc string) error

ValidateDesc ensures the app description provided adheres to the standards for app descriptions. We're picky here because these will display in the Tidbyt mobile app and need to display properly.

func ValidateID

func ValidateID(id string) error

ValidateID ensures the id will parse when we go to add it to our database internally.

func ValidateName

func ValidateName(name string) error

ValidateName ensures the app name provided adheres to the standards for app names. We're picky here because these will display in the Tidbyt mobile app and need to display properly.

func ValidateSummary

func ValidateSummary(summary string) error

ValidateSummary ensures the app summary provided adheres to the standards for app summaries. We're picky here because these will display in the Tidbyt mobile app and need to display properly.

Types

type Manifest

type Manifest struct {
	// ID is the unique identifier of this app. It has to be globally unique,
	// which means it cannot conflict with any of our private apps.
	ID string `json:"id" yaml:"id"`

	// Name is the name of the applet. Ex. "Fuzzy Clock"
	Name string `json:"name" yaml:"name"`

	// Summary is the short form of what this applet does. Ex. "Human readable
	// time".
	Summary string `json:"summary" yaml:"summary"`

	// Desc is the long form of what this applet does. Ex. "Display the time in
	// a groovy, human-readable way."
	Desc string `json:"desc" yaml:"desc"`

	// Author is the person or organization who contributed this applet. Ex,
	// "Max Timkovich"
	Author string `json:"author" yaml:"author"`

	// Source is the starlark source code for this applet using the go `embed`
	// module.
	Source []byte `json:"-" yaml:"-"`
}

Manifest is a structure to define a starlark applet for Tidbyt in Go.

func LoadManifest

func LoadManifest(r io.Reader) (*Manifest, error)

LoadManifest reads a manifest from an io.Reader, with the most common reader being a file from os.Open. It returns a manifest or an error if it could not be parsed.

func (Manifest) Validate

func (m Manifest) Validate() error

Validate ensures all fields of the manifest are valid and returns an error if they are not.

func (*Manifest) WriteManifest

func (m *Manifest) WriteManifest(w io.Writer) error

WriteManifest writes a manifest to the supplied writer, with the most common writer being a file. Any issue will return an error.

Jump to

Keyboard shortcuts

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