util

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultPath = filepath.Join(GetHomeDir(), ".gopwd")
	DefaultName = "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 GetPassword

func GetPassword() (string, error)

func InitConfig

func InitConfig(Path string, Name string, configFile string) (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 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"`
	Name string `json:"name"`
}

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
JackTT - Gopher 🇻🇳