short

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const ParamRegExp = `#([.-_a-z]+):([a-z]+)#`

Variables

View Source
var Types = []string{"string", "int", "uint", "float", "date", "time", "bool"}

Functions

func Add

func Add(c Cut, allCuts map[string]Cut) error

func Command

func Command(cutName string, allCuts map[string]Cut, runtimeParams map[string]string) (cmd string, err error)

func CommandAndValues

func CommandAndValues(cutName string, allCuts map[string]Cut, runtimeParams map[string]string) (cmd string, vals map[string]string, err error)

func Exec

func Exec(cutName string, allCuts map[string]Cut, runtimeParams map[string]string) (err error)

func Load

func Load(configJSON io.Reader) (allCuts map[string]Cut, err error)

func Params

func Params(cutName string, allCuts map[string]Cut) (paramsDefinition map[string]string, err error)

func Save

func Save(configJSON io.Writer, allCuts map[string]Cut) (err error)

Types

type Cut

type Cut struct {
	Name    string `json:name`    // names may contain dots to create namespaces (to allow grouping)
	Command string `json:command` // a command for the shell. placeholders are defined by inserting something like #Name: Type#, where
	// Name is the name of the parameter and Type is one of string, int, uint, float, date, time
	// placeholders may have defaults and are asked when the shortcut is executed
	// if command starts with a colon, then the followong name is the name of the parent command of which this command is a special case
	Defaults map[string]string `json:defaults` // default values
}

type Cuts

type Cuts []Cut

func Sort

func Sort(allCuts map[string]Cut) (cs Cuts)

func (Cuts) Len

func (c Cuts) Len() int

func (Cuts) Less

func (c Cuts) Less(a, b int) bool

func (Cuts) Swap

func (c Cuts) Swap(a, b int)

Directories

Path Synopsis
cmd
short module

Jump to

Keyboard shortcuts

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