aliasm

package
v0.2.25 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ALIAS_TBL = "aliases"
)

Functions

func GetAliasDb

func GetAliasDb(logger *zerolog.Logger) (*db.Storage, error)

Types

type AliasInfo

type AliasInfo struct {
	Alias     string `yaml:"alias"`
	Command   string `yaml:"command"`
	Timestamp int64  `yaml:"timestamp"`
	Hash      string `yaml:"-"`
	// Not supported for now
	Tag []string `yaml:"tag"`
}

func NewAlias

func NewAlias() *AliasInfo

type Aliases

type Aliases struct {
	Db      *db.Storage
	Logger  *zerolog.Logger
	Aliases []AliasInfo `yaml:"aliases"`
}

func (*Aliases) Load

func (alias *Aliases) Load() (map[interface{}]interface{}, error)

func (*Aliases) Order

func (aliases *Aliases) Order()

Order aliases regarding SortBy option defined in config yaml Prefix "-" reverses the order, default is "recency", "+<expressions>" is the same as "<expression>"

func (*Aliases) ToAliasString

func (alias *Aliases) ToAliasString() (string, error)

func (*Aliases) ToString

func (aliases *Aliases) ToString() (string, error)

ToString returns the contents of yaml file.

type ByCommand

type ByCommand []AliasInfo

func (ByCommand) Len

func (a ByCommand) Len() int

func (ByCommand) Less

func (a ByCommand) Less(i, j int) bool

func (ByCommand) Swap

func (a ByCommand) Swap(i, j int)

type ByDescription

type ByDescription []AliasInfo

func (ByDescription) Len

func (a ByDescription) Len() int

func (ByDescription) Less

func (a ByDescription) Less(i, j int) bool

func (ByDescription) Swap

func (a ByDescription) Swap(i, j int)

Jump to

Keyboard shortcuts

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