rcparse

package
v0.0.0-...-5781d3f Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package rcparse holds the interface for the rcfile and the implementations for handling various rcfile types i.e. simple, yaml, klingon, etc.

Index

Constants

View Source
const (
	Start = iota
	InDoubleq
	InSingleq
	InWord
	InSpace
)

Variables

This section is empty.

Functions

func ParseCmd

func ParseCmd(cmd string) (string, []string, error)

Types

type CmdEnv

type CmdEnv struct {
	Cmd  []string
	Envs map[string]string
}

type RCFile

type RCFile interface {
	Parse(r io.Reader) error
	GetCommand(rule string) ([]string, bool)
	GetCommandEnv(rule string) ([]string, map[string]string, bool)
	ListRules() ([]string, error)
}

type YRCFileEntry

type YRCFileEntry struct {
	Rule     string            `yaml:"rule"`
	Commands []string          `yaml:"c"`
	Env      map[string]string `yaml:"env,omitempty"`
}

type YRCFormat

type YRCFormat struct {
	Items   []YRCFileEntry    `yaml:"wf_file"`
	Globals map[string]string `yaml:"globals,omitempty"`
}

type YRCfile

type YRCfile struct {
	G        map[string]string
	Commands map[string]CmdEnv
}

func CreateYRCFile

func CreateYRCFile(rd io.Reader) (*YRCfile, error)

func NewYRCFile

func NewYRCFile(filename string) (*YRCfile, error)

func (*YRCfile) GetCommand

func (rc *YRCfile) GetCommand(rule string) ([]string, bool)

func (*YRCfile) GetCommandEnv

func (rc *YRCfile) GetCommandEnv(rule string) ([]string, map[string]string, bool)

func (*YRCfile) ListRules

func (rc *YRCfile) ListRules() ([]string, error)

func (*YRCfile) Parse

func (rc *YRCfile) Parse(r io.Reader) error

Jump to

Keyboard shortcuts

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