rules

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(file File) error

Types

type File

type File struct {
	Version     int          `json:"version,omitempty"`
	Profiles    []Profile    `json:"profiles,omitempty"`
	Preferences []Preference `json:"preferences,omitempty"`
}

func ParseFile

func ParseFile(path string, data []byte) (File, error)

func ParseJSON

func ParseJSON(data []byte) (File, error)

func ParseYAML

func ParseYAML(data []byte) (File, error)

type Format

type Format string
const (
	FormatUnknown Format = ""
	FormatJSON    Format = "json"
	FormatYAML    Format = "yaml"
)

func Discover

func Discover(startDir string) (string, Format, error)

func DiscoverWith

func DiscoverWith(startDir string, stat func(string) (os.FileInfo, error)) (string, Format, error)

type Match

type Match struct {
	CommandPrefix []string `json:"command_prefix,omitempty"`
	DisplayPrefix []string `json:"display_prefix,omitempty"`
	AllArgs       []string `json:"all_args,omitempty"`
	AnyArgs       []string `json:"any_args,omitempty"`
	ExcludeArgs   []string `json:"exclude_args,omitempty"`
	CwdContains   []string `json:"cwd_contains,omitempty"`
}

type Preference

type Preference struct {
	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
	Explain     []string `json:"explain,omitempty"`
	Match       Match    `json:"match"`
	Rewrite     Rewrite  `json:"rewrite"`
}

type Profile

type Profile struct {
	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
	Explain     []string `json:"explain,omitempty"`
	Match       Match    `json:"match"`
	Rewrite     Rewrite  `json:"rewrite,omitempty"`
	Render      Render   `json:"render,omitempty"`
}

type Render

type Render struct {
	Mode     string `json:"mode,omitempty"`
	MaxLines int    `json:"max_lines,omitempty"`
}

type Rewrite

type Rewrite struct {
	Mode         string   `json:"mode,omitempty"`
	Placement    string   `json:"placement,omitempty"`
	Args         []string `json:"args,omitempty"`
	SkipIfHasAny []string `json:"skip_if_has_any,omitempty"`
}

Jump to

Keyboard shortcuts

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