examples

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package examples provides access to embedded scafctl example files.

Examples are embedded at build time via go:embed, making them available in distributed binaries without filesystem access to the source repo.

For development, examples are also looked up from the filesystem as a fallback when the embedded filesystem is empty or when the examples weren't copied at build time.

Index

Constants

This section is empty.

Variables

View Source
var EmbeddedExamples embed.FS

Functions

func Categories

func Categories() []string

Categories returns the list of available example categories.

func DescriptionFromPath

func DescriptionFromPath(path string) string

DescriptionFromPath generates a human-readable description from a file path.

func Read

func Read(path string) (string, error)

Read returns the contents of an example file.

Types

type Example

type Example struct {
	Path        string `json:"path"`
	Category    string `json:"category"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

Example represents an example file in the listing.

func Scan

func Scan(category string) ([]Example, error)

Scan walks the examples filesystem and returns matching examples. If category is empty, returns all examples.

Jump to

Keyboard shortcuts

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