alias

package
v2.16.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alias

type Alias struct {
	// alias' key
	Name string
	// whole command
	Command []string
	// contains filtered or unexported fields
}

func (*Alias) Args

func (a *Alias) Args() []string

type Config

type Config struct {
	// Aliases are raw aliases that allow to expand a command
	// "scw instance sl", sl may be an alias and would expand command
	// "scw instance server list"
	// key = sl
	// value = server, list
	Aliases map[string][]string `yaml:"aliases"`
	// contains filtered or unexported fields
}

func EmptyConfig

func EmptyConfig() *Config

func (*Config) AddAlias

func (c *Config) AddAlias(name string, command []string) bool

AddAlias add alias to config return true if alias has been replaced

func (*Config) DeleteAlias

func (c *Config) DeleteAlias(name string) bool

DeleteAlias deletes an alias return true if alias was deleted

func (*Config) GetAlias

func (c *Config) GetAlias(name string) []string

GetAlias return raw alias for a given string

func (*Config) ResolveAliases

func (c *Config) ResolveAliases(command []string) []string

ResolveAliases resolve aliases in given command "scw isl" may return "scw instance server list"

func (*Config) ResolveAliasesByFirstWord

func (c *Config) ResolveAliasesByFirstWord(firstWord string) ([]Alias, bool)

ResolveAliasesByFirstWord return list of aliases that start with given first word firstWord: instance may return isl => instance server list isc => instance server create

Jump to

Keyboard shortcuts

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