config

package
v1.0.0-rc.71 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Schema: "https://github.com/pomdtr/sunbeam/releases/latest/download/config.schema.json",
	Oneliners: []Oneliner{
		{
			Title:   "Open Sunbeam Docs",
			Command: "sunbeam open https://pomdtr.github.io/sunbeam/book/introduction.html",
		},
		{
			Title:   "Edit Config",
			Command: "sunbeam edit --config",
		},
	},
	Extensions: map[string]ExtensionRef{
		"devdocs": {
			Origin: "https://raw.githubusercontent.com/pomdtr/sunbeam/main/extensions/devdocs.sh",
		},
		"google": {
			Origin: "https://raw.githubusercontent.com/pomdtr/sunbeam/main/extensions/google.sh",
		},
	},
}

Functions

func CommandParam

func CommandParam(command types.CommandSpec, name string) (types.Param, bool)

func ExtractParams

func ExtractParams(args []string, command types.CommandSpec) (map[string]any, error)

func Path

func Path() string

Types

type Config

type Config struct {
	Schema     string                  `json:"$schema,omitempty"`
	Oneliners  []Oneliner              `json:"oneliners,omitempty"`
	Extensions map[string]ExtensionRef `json:"extensions,omitempty"`
}

func Load

func Load() (Config, error)

func (Config) RootItem

func (c Config) RootItem(item Oneliner, extensionMap map[string]extensions.Extension) (types.ListItem, error)

type ExtensionRef

type ExtensionRef struct {
	Origin      string         `json:"origin"`
	Preferences map[string]any `json:"preferences,omitempty"`
}

func (*ExtensionRef) UnmarshalJSON

func (e *ExtensionRef) UnmarshalJSON(b []byte) error

type Oneliner

type Oneliner struct {
	Title   string `json:"title"`
	Command string `json:"command"`
}

Jump to

Keyboard shortcuts

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