utils

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: ISC Imports: 31 Imported by: 1

Documentation

Index

Constants

View Source
const CONFIG_VERSION = "v1.0.0"

Variables

View Source
var VERSION = func() string {
	version := "v1.1.7"
	if strings.HasSuffix(version, "-devel") {
		if info, ok := debug.ReadBuildInfo(); ok {
			for _, setting := range info.Settings {
				if setting.Key == "vcs.revision" {
					version += "." + setting.Value
				}
			}
		}
	}
	return version
}()

Functions

func BrowserTrySpawn

func BrowserTrySpawn(url string) error

func CheckPlaintext added in v1.1.5

func CheckPlaintext(location string, encrypted bool) error

func GetCacheDir

func GetCacheDir(appName string) (string, error)

func GetConf

func GetConf(rd io.Reader, thirdParty string) (map[string]map[string]string, error)

func GetConfigDir

func GetConfigDir(appName string) (string, error)

func GetDataDir

func GetDataDir(appName string) (string, error)

func GetPassphrase

func GetPassphrase(prefix string) ([]byte, error)

func GetPassphraseConfirm

func GetPassphraseConfirm(prefix string, minEntropyBits float64, retry int) ([]byte, error)

func GetPassphraseFromCommand

func GetPassphraseFromCommand(cmd string) (string, error)

func GetVersion

func GetVersion() string

func LoadConfig

func LoadConfig(configDir string) (*config.Config, error)

func LoadINI

func LoadINI(rd io.Reader) (map[string]map[string]string, error)

func LoadJSON

func LoadJSON(rd io.Reader) (map[string]map[string]string, error)

LoadJSON loads a JSON object and returns a nested map[string]map[string]string.

func LoadOldConfigIfExists

func LoadOldConfigIfExists(configFile string) (*config.Config, error)

func LoadPolicyConfigFile

func LoadPolicyConfigFile(filename string) (*policiesConfig, error)

func LoadYAML

func LoadYAML(rd io.Reader) (map[string]map[string]string, error)

func ParseSnapshotID

func ParseSnapshotID(id string) (string, string)

ParseSnapshotID parses a string in the form snapshotID[:pattern] and returns the two strings.

func ParseTimeFlag

func ParseTimeFlag(input string) (time.Time, error)

func SanitizeText

func SanitizeText(input string) string

func SaveConfig

func SaveConfig(configDir string, cfg *config.Config) error

func ValidateEmail

func ValidateEmail(email string) (string, error)

Types

type OldConfig

type OldConfig struct {
	DefaultRepository string                             `yaml:"default-repo"`
	Repositories      map[string]config.RepositoryConfig `yaml:"repositories"`
	Remotes           map[string]config.SourceConfig     `yaml:"remotes"`
}

type OptsFlag

type OptsFlag struct {
	// contains filtered or unexported fields
}

func NewOptsFlag

func NewOptsFlag(opts map[string]string) *OptsFlag

func (*OptsFlag) Set

func (o *OptsFlag) Set(s string) error

func (*OptsFlag) String

func (o *OptsFlag) String() string

type ReleaseUpdateSummary

type ReleaseUpdateSummary struct {
	FoundCount int
	Latest     string

	SecurityFix    bool
	ReliabilityFix bool
}

func CheckUpdate

func CheckUpdate(cachedir string) (update ReleaseUpdateSummary, err error)

type TimeFlag

type TimeFlag struct {
	// contains filtered or unexported fields
}

TimeFlag implements flag.Value interface

func NewTimeFlag

func NewTimeFlag(dest *time.Time) *TimeFlag

func (*TimeFlag) Set

func (t *TimeFlag) Set(s string) error

func (*TimeFlag) String

func (t *TimeFlag) String() string

Jump to

Keyboard shortcuts

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