utils

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Utilities required for go-archive-it

https://github.com/korbexmachina/go-archive-it

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Archive

func Archive(vaultPath string, archivePath string, archiveType uint8)

Archive takes 3 arguments, and calls the appropriate archive function, passing on it's other arguments.

args:

vaultPath string: The path to the directory that will be archived
archivePath string: The name of the directory where all of the archives are to be stored
archiveType uint8: The type of archive that is to be created
	- 0 = .tar
	- 1 = .tar.gz

This function does not return a value and logs it's own errors.

Archive creates any directories neccesary for it to function.

func Cleanup

func Cleanup(archivePath string, retention uint8, verbose bool) error

Cleanup takes 3 arguments and returns an error

args: archivePath string: The path to the archive that is being cleaned up retention uint8: The number of archives that should be retained verbose bool: whether or not the verbose flag was specified

Cleanup returns an error if something goes wrong

func ConfigExists

func ConfigExists(configPath string)

ConfigExists checks if a config file exists at a specified location

If no config file is found, one is created with some default values, and the user is prompted to make any neccesary changes

Types

type Config

type Config struct {
	VaultPath   []string
	ArchivePath string
	ArchiveType uint8
	Retention   uint8
}

Config is a struct used to parse configuration files

func LoadConfig

func LoadConfig(configPath string) Config

LoadConfig reads and unmarshals a yaml file given a path, it returns a Config struct with the data from the file

Jump to

Keyboard shortcuts

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