utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

NETWORK.GO Contains bigger functions that have to do with Git or networking.

SYMLINKS.GO ------------ Contains bigger functions related to creating and handling symlinks.

SYSTEMS.GO Contains bigger functions that have to deal with paths or the filesystem.

UTILS.GO ------------ Contains utility functions and other small, useful things

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolAnd added in v0.3.0

func BoolAnd(first bool, second bool) bool

BoolAnd uses booleans in an AND operator

func CheckBetter added in v0.3.0

func CheckBetter(check int, better int, checkbetter bool) (int, bool)

CheckBetter checks if better is greater than check. If it is, it returns better, otherwise it returns check. It also returns a BoolAnd of checkbetter and if better > check.

func CloneRepo added in v0.2.4

func CloneRepo(stagePath string, repo string) string

CloneRepo clones a repo into the specified location.

func CloneTemplate added in v1.0.0

func CloneTemplate(repo string)

CloneTemplate creates the template directory and clones the template repo into it.

func DieIfError added in v1.0.0

func DieIfError(err error, message string)

DieIfError kills the program if err is not nil.

func GetEnv

func GetEnv(lookup string, fallback string) string

GetEnv gets an environment variable. If not defined, it gets the fallback.

func GetTemplateDir added in v1.0.0

func GetTemplateDir(repo string) string

GetTemplateDir gets the location of the template directory.

func HandleDir added in v0.2.4

func HandleDir(dir string) string

HandleDir handles a directory, replacing certain parts with known attributes.

func HandleDirPath added in v0.2.4

func HandleDirPath(baseDir string, link string, finalDir string, name string) []string

HandleDirPath is a function to handle a directory when making a symlink

func HandleFilePath added in v0.2.4

func HandleFilePath(finalDir string, name string)

HandleFilePath handles files that are made with symlinks

func InitTemplate added in v1.0.0

func InitTemplate(repo string, exec string, linuxloc string, macloc string, windowsloc string)

InitTemplate initializes a template repo for the repo name specified.

func InstallFlavours added in v0.4.0

func InstallFlavours(baseDir string, mode string, flavour string, ctprc structs.Program, installLoc string) []string

InstallFlavours is a wrapper for InstallLinks which takes the flavour and handles the install accordingly

func InstallLinks(baseDir string, entry structs.Entry, to string, finalDir string, mode string) []string

InstallLinks is a wrapper over MakeLinks that parses the mode and uses it to create the correct link, as specified by the ctprc.

func IsWindows

func IsWindows() bool

IsWindows checks if OS is Windows

func ListContains added in v0.3.0

func ListContains(list []string, contains string) bool

ListContains checks if a list of strings contains a string

func MakeLinks(baseDir string, links []string, to string, finalDir string) []string

MakeLinks loops through a list and converts its attributes into arguments for MakeLink.

func MakeLocation added in v1.0.0

func MakeLocation(packages string, location []string)

MakeLocation saves the locations written to during installation into a file for later access.

func OSReadDir added in v1.0.0

func OSReadDir(root string) ([]string, error)

OSReadDir expands a directory path into a list of files within that directory. Not recursive.

func PathExists

func PathExists(path string) bool

PathExists checks if a path exists

func PullUpdates added in v0.2.4

func PullUpdates(repo string)

PullUpdates opens a git repo and pulls the latest changes.

func SearchRepos added in v0.3.0

func SearchRepos(repos structs.SearchRes, term string) structs.SearchEntry

SearchRepos searches through a SearchRes for the best match

func ShareDir added in v0.2.4

func ShareDir() string

ShareDir generates the share directory for the cli.

func UpdateJSON added in v0.3.0

func UpdateJSON()

UpdateJSON makes a search request for all Catppuccin repos and caches them.

func UserHomeDir added in v0.2.4

func UserHomeDir() string

UserHomeDir gets the user's home directory

Types

This section is empty.

Jump to

Keyboard shortcuts

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