util

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultPath = filepath.Join(GetHomeDir(), ".gopwd", "vault")
)

Functions

func ConfirmAction

func ConfirmAction() (bool, error)

func CopyFile

func CopyFile(src, dst string) error

func CreateDirectory

func CreateDirectory(path string) error

func CreateFile

func CreateFile(path string) error

func CreateTempFileFromBytes

func CreateTempFileFromBytes(content []byte) *os.File

func Exists

func Exists(path string) (bool, error)

func GetGPGID

func GetGPGID(path string) (string, error)

func GetHomeDir

func GetHomeDir() string

func GetNestedDirectories added in v1.1.3

func GetNestedDirectories(dirPath string) ([]string, error)

func GetPassword

func GetPassword() (string, error)

func InitConfig

func InitConfig(Path string, configFile string) (string, string, error)

func PrintDirectoryTree

func PrintDirectoryTree(dirPath string, indent string) error

func ReadBytesFromFile

func ReadBytesFromFile(filePath string) ([]byte, error)

ReadBytesFromFile reads the content of a file and returns it as a byte slice.

func ReadDirectory

func ReadDirectory(path string) ([]fs.DirEntry, error)

func ReadFile

func ReadFile(path string) ([]byte, error)

func RemoveDirectory

func RemoveDirectory(path string) error

func RemoveFile added in v1.1.3

func RemoveFile(path string) error

func WalkDir added in v1.2.0

func WalkDir(path string) ([]string, error)

func WriteBytesToFile

func WriteBytesToFile(path string, data []byte) error

func WriteToFile

func WriteToFile(path string, data string) error

Types

type Config

type Config struct {
	Path string `json:"path"`
}

Config holds the configuration data

func LoadConfig

func LoadConfig(configFile string) (*Config, error)

Jump to

Keyboard shortcuts

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