utils

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigStoreData []ConfigStore
View Source
var UserConfigDir string

Functions

func CompareHashes

func CompareHashes(hash1, hash2 []byte) (bool, error)

func ContainsString

func ContainsString(slice []string, item string) bool

func CreateShortcut

func CreateShortcut(profilepaths []string, name string, path string, shell string) error

func CreateTempFile

func CreateTempFile(merged string) (string, error)

create temp file with merged profiles

func EncodeCommand

func EncodeCommand(command string) (string, error)

func ExecuteCommandWithPowershell

func ExecuteCommandWithPowershell(encodedCmd string) error

func ExecuteInsideShell added in v0.0.3

func ExecuteInsideShell(encodedCmd string) error

func ExtractString

func ExtractString(input string, pattern string) (string, error)

func GenerateUniqueID added in v0.0.3

func GenerateUniqueID() string

func GetProfileContent

func GetProfileContent(path string) (string, error)

func GetProfileProperties

func GetProfileProperties(path string) (types.ProfileItem, error)

func GetWindowSize

func GetWindowSize() (int, int)

func LaunchProfilesFromCmd

func LaunchProfilesFromCmd(profiles string, shell string) error

func LoadProfileContent

func LoadProfileContent(profilePath string) (string, error)

func LoadProfilesFromDir

func LoadProfilesFromDir() ([]types.ProfileItem, error)

func LoadShells

func LoadShells() ([]types.ShellItem, error)

func MergeSelectedProfiles

func MergeSelectedProfiles(selected []string) string

func NormalizeString

func NormalizeString(s string) string

func SplitProfiles

func SplitProfiles(profiles string) []string

func ValidateDescription

func ValidateDescription(description string) (bool, error)

func ValidateHash

func ValidateHash(expectedHash, filePath string) (bool, error)

func ValidatePath

func ValidatePath(path string) (bool, error)

func ValidateShellVersion

func ValidateShellVersion(shellVersion string) (bool, error)

Types

type Config

type Config struct {
	Profile struct {
		Path      string `mapstructure:"path"`
		Recursive bool   `mapstructure:"recursive"`
	} `mapstructure:"profile"`
	Logging struct {
		Path  string `mapstructure:"path"`
		File  string `mapstructure:"file"`
		Level string `mapstructure:"level"`
	} `mapstructure:"logging"`
	Shortcuts []Shortcut `mapstructure:"shortcuts"`
}

func LoadConfig

func LoadConfig() (*Config, error)

type ConfigStore

type ConfigStore struct {
	Path   string
	Exists bool
}

type DefaultHashValidator

type DefaultHashValidator struct{}

func (DefaultHashValidator) ValidateHash

func (d DefaultHashValidator) ValidateHash(expectedHash, filePath string) (bool, error)

type HashValidator

type HashValidator interface {
	ValidateHash(expectedHash, filePath string) (bool, error)
}

type Profile added in v0.0.3

type Profile struct {
	Name string `mapstructure:"name"`
	Path string `mapstructure:"path"`
}

type Shortcut added in v0.0.3

type Shortcut struct {
	ID          string    `mapstructure:"id"`
	Name        string    `mapstructure:"name"`
	Destination string    `mapstructure:"destination"`
	Profiles    []Profile `mapstructure:"profiles"`
}

Jump to

Keyboard shortcuts

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