yaml

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package yaml is an internal package for parsing config files into a format that is similar to cobra commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasNameCollisions added in v0.2.0

func HasNameCollisions(configs []OneTerminalConfig) error

HasNameCollisions returns an error if multiple configs have the same name, alias or one of the reserved names (for built in oneterminal cmds like help)

func WriteExampleConfig added in v0.4.1

func WriteExampleConfig(filename string) error

WriteExampleConfig makes an example oneterminal yaml config at ~/.config/oneterminal/example.yml with comments describing each field

Types

type Command

type Command struct {
	Name        string            `yaml:"name"`
	Command     string            `yaml:"command"`
	CmdDir      string            `yaml:"directory,omitempty"`
	Silence     bool              `yaml:"silence,omitempty"`
	ReadyRegexp string            `yaml:"ready-regexp,omitempty"`
	DependsOn   []string          `yaml:"depends-on,omitempty"`
	Environment map[string]string `yaml:"environment,omitempty"`
}

Command is what will run in one terminal "window"/tab

type OneTerminalConfig

type OneTerminalConfig struct {
	Name     string    `yaml:"name"`
	Alias    string    `yaml:"alias"`
	Shell    string    `yaml:"shell"`
	Short    string    `yaml:"short"`
	Long     string    `yaml:"long,omitempty"`
	Commands []Command `yaml:"commands"`
}

OneTerminalConfig of all the fields from a yaml config

func ParseAllConfigs added in v0.2.0

func ParseAllConfigs() ([]OneTerminalConfig, error)

ParseAllConfigs parses and returns configs in ~/.config/oneterminal

Jump to

Keyboard shortcuts

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