utils

package
v2.5.5 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	YamlConfigurationType = "yaml"
	JsonConfigurationType = "json"
	TomlConfigurationType = "toml"
)
View Source
const (
	PluginsDirName   = "plugins"
	PluginConfigName = "ali-plugin.yml"
)
View Source
const TemplateDirName = "templates"

Variables

View Source
var Colors = map[string]string{
	"red":     "\033[38;5;210m",
	"green":   "\033[32m",
	"yellow":  "\033[38;5;221m",
	"blue":    "\033[38;5;110m",
	"magenta": "\033[35m",
	"cyan":    "\033[36m",
	"gray":    "\033[90m",
	"orange":  "\033[38;5;214m",
	"pink":    "\033[38;5;207m",
	"lime":    "\033[38;5;10m",
	"white":   "\033[37m",
	"reset":   "\033[0m",
}
View Source
var ErrHiddenEnvFileNotFound = errors.New("hidden envs file not found")
View Source
var ErrUnsupportedConfigType = errors.New("unsupported config type")

Functions

func CheckError

func CheckError(v any)

func Colorize

func Colorize(text, color string) string

func FileExists

func FileExists(path string) bool

func GetAlias

func GetAlias(aliasName string) any

func GetConfigurationType

func GetConfigurationType(path string) (string, error)

GetConfigurationType функция для определения типа конфигурации. Deprecated: функция больше не используется

func GetEnvs

func GetEnvs(alias *AliasEntry) map[string]any

func GetPluginDirByName

func GetPluginDirByName(name string) (string, error)

func GetPlugins

func GetPlugins() ([]string, error)

func GetPluginsDir

func GetPluginsDir() (string, error)

func GetTemplNameByFile

func GetTemplNameByFile(filename string) string

func GetVariables

func GetVariables(input string, vars map[string]string) string

func GetVars

func GetVars() (map[string]string, error)

func GetViperForPlugin

func GetViperForPlugin(path string) (*viper.Viper, error)

func LoadAliases

func LoadAliases(v *viper.Viper) map[string]AliasEntry

func LoadHiddenEnv

func LoadHiddenEnv(filepath string) (map[string]any, error)

func PrepareCommand

func PrepareCommand(
	command string, dir string,
	args []string, flags map[string]string,
	envs map[string]any, print bool,
) (*exec.Cmd, error)

func PrintError

func PrintError(msg string, err error)

PrintError функция, которая выводит краткую информацию о том, что произошла ошибка, а в дебаг логи выводит подробную ошибку, которая произошла

func TruncateString

func TruncateString(str string, maxLen int) string

Types

type AliasEntry

type AliasEntry struct {
	AliasName string         `mapstructure:"alias"`
	Aliases   []string       `mapstructure:"aliases"`
	Cmds      []string       `mapstructure:"cmds"`
	Desc      string         `mapstructure:"desc"`
	Env       map[string]any `mapstructure:"env"`
	Parallel  bool           `mapstructure:"parallel"`
	Dir       string         `mapstructure:"dir"`
}

func SearchSynonyms

func SearchSynonyms(aliases map[string]AliasEntry, search string) *AliasEntry

Jump to

Keyboard shortcuts

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