menu

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2020 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Home

func Home() string

Home retrieves path of kut home e.g. /home/james/.kut

func Ingest

func Ingest(source string) error

Ingest a file into system store

func List

func List() []string

List generates available menus

func Path

func Path(name string) string

Path generates the path to the named menu

func Render

func Render(action Action) (string, error)

Render an action into a command

func Repo

func Repo() string

Repo retrieves path of local repo e.g. /home/james/.kut/menus

Types

type Action

type Action struct {
	Name     string  `json:"name" binding:"required"`
	Help     string  `json:"help"`
	Template string  `json:"template" binding:"required"`
	Params   []Param `json:"params"`
}

Action struct: a thing a user can do

type Menu struct {
	Name    string   `json:"name" binding:"required"`
	Version string   `json:"version"`
	Help    string   `json:"help"`
	Actions []Action `json:"actions" binding:"required"`
	Hash    string   `json:"hash"`
}

Menu struct: a list of actions

func Load

func Load(name string) (Menu, error)

Load a menu given a name

func Parse added in v0.4.6

func Parse(data []byte) (Menu, error)

Parse a menu given a blob

type Param

type Param struct {
	Name  string `json:"name" binding:"required"`
	Help  string `json:"help"`
	Value string `json:"value"`
}

Param struct: a parameter for a action

Jump to

Keyboard shortcuts

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