mirror of
https://github.com/Luzifer/duplicity-backup.git
synced 2024-11-08 23:20:05 +00:00
236 lines
7.3 KiB
Go
236 lines
7.3 KiB
Go
|
// Code generated by go-bindata.
|
||
|
// sources:
|
||
|
// help.txt
|
||
|
// DO NOT EDIT!
|
||
|
|
||
|
package main
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"compress/gzip"
|
||
|
"fmt"
|
||
|
"io"
|
||
|
"io/ioutil"
|
||
|
"os"
|
||
|
"path/filepath"
|
||
|
"strings"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func bindataRead(data []byte, name string) ([]byte, error) {
|
||
|
gz, err := gzip.NewReader(bytes.NewBuffer(data))
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("Read %q: %v", name, err)
|
||
|
}
|
||
|
|
||
|
var buf bytes.Buffer
|
||
|
_, err = io.Copy(&buf, gz)
|
||
|
clErr := gz.Close()
|
||
|
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("Read %q: %v", name, err)
|
||
|
}
|
||
|
if clErr != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return buf.Bytes(), nil
|
||
|
}
|
||
|
|
||
|
type asset struct {
|
||
|
bytes []byte
|
||
|
info os.FileInfo
|
||
|
}
|
||
|
|
||
|
type bindataFileInfo struct {
|
||
|
name string
|
||
|
size int64
|
||
|
mode os.FileMode
|
||
|
modTime time.Time
|
||
|
}
|
||
|
|
||
|
func (fi bindataFileInfo) Name() string {
|
||
|
return fi.name
|
||
|
}
|
||
|
func (fi bindataFileInfo) Size() int64 {
|
||
|
return fi.size
|
||
|
}
|
||
|
func (fi bindataFileInfo) Mode() os.FileMode {
|
||
|
return fi.mode
|
||
|
}
|
||
|
func (fi bindataFileInfo) ModTime() time.Time {
|
||
|
return fi.modTime
|
||
|
}
|
||
|
func (fi bindataFileInfo) IsDir() bool {
|
||
|
return false
|
||
|
}
|
||
|
func (fi bindataFileInfo) Sys() interface{} {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var _helpTxt = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xac\x93\x3f\x73\xdb\x30\x0c\xc5\x77\x7d\x0a\x8c\xed\xa0\x64\xcf\xd6\x8b\x2f\x53\x87\x5e\x7b\xbd\x0e\x3e\x0f\x30\x05\x49\xbc\xd0\xa4\x0e\x04\x93\xda\x43\x3f\x7b\xc1\x3f\x76\xe4\xa4\xde\xca\x4d\xe4\xc3\x8f\x4f\x8f\xc0\x2f\xc6\x65\x21\x06\xe4\x90\xfc\x00\x43\x5a\x9c\x35\x56\x8e\x20\x01\x0c\x13\x0a\xc1\x1e\xcd\x73\x5a\xe0\xd5\xca\x0c\x8e\x62\x84\x19\x4f\x27\x47\x5d\xf7\x33\xe2\x44\x0f\x1d\xbc\x55\xf5\x4d\xbb\x35\xe1\x70\x40\x3f\xec\xba\xee\xcb\x0b\x5a\x87\x7b\x47\xf0\x58\xf7\x62\xae\x68\xba\x1b\xeb\xf1\xea\x62\x34\x26\xf0\x60\xfd\x94\x3d\xc9\x7c\xd9\xe7\xa4\x6e\x94\x65\x1c\xa1\xbf\x09\xdb\x90\x23\x65\xe5\x3a\xfa\x2d\x8c\x9e\x42\x8a\xab\xff\x1c\x6d\xa5\x38\x1b\xa5\x37\x89\x99\xbc\xf4\x65\x73\x4d\xf9\xaa\xa7\xb1\x40\xea\x91\x09\x5e\xd0\x7a\x1a\xc0\xfa\x95\x27\xe5\x30\x45\x09\x4c\xb0\xcd\x42\x58\x50\xe6\x1d\x6c\x05\x79\x22\xd9\x01\x7c\xaf\xa7\x11\xa2\xfe\x8f\xab\x34\xb8\x87\xc1\x72\xf9\xb9\x22\xcb\x5f\x64\x54\x76\x5c\xe3\x2e\x88\xf5\xba\xe0\xe8\x85\xf8\x28\xf3\x39\xa4\x8f\x9c\x28\x28\x29\xde\x0a\xfc\x47\xd2\xa7\x61\x7b\xaa\x39\x35\x6d\x18\xaf\xd2\xa6\x25\x44\xdb\x68\x7a\x9b\x1d\x8f\x37\x9f\x2f\x1c\x16\xcc\xae\x5a\x69\x0e\x4b\x53\x8d\x80\x93\x66\x16\x05\x5c\x30\xe8\x5a\xf2\xdd\x93\xc3\xa9\xf4\x44\xdf\xab\x70\xb4\x53\xdf\x42\xe9\xc7\x6b\x68\x3e\x4b\x8c\x62\x83\x87\x31\x68\x60\xb3\x5d\x3f\xe4\x6b\xed\xe4\xee\x96\xab\xf3\xfa\xb4\xa1\x11\x93\x93\x07\xf8\x73\x7f\x57\x6f\xbc\x7f\xdf\xc0\x77\x47\x3c\xb8\xcf\xc5\x93\x7a\x7d\xbe\x38\x72\xd7\xa8\xa7\xbc\xad\x79\xcf\xc1\x0d\x25\xab\x2c\x7e\xf3\xd6\x1c\x69\xdf\x91\x49\xd9\xf6\xff\xf1\x96\x2f\xa9\xde\x06\xda\xa7\x29\xfb\x1a\x3e\xa2\xbe\xb1\xf5\xb2\x8a\xa7\x4d\x64\xcc\x7e\x43\x92\x25\x49\x45\xb0\xf4\x9c\x7c\x86\xf8\xf7\x88\x4d\x00\x04\xd1\x16\x2b\x8a\x3c\xff\x5a\x08\x66\x46\x3f\x95\x91\xe9\x7b\xed\x83\x98\x9f\xe3\x5f\xab\x18\xa8\x33\xd3\xc6\x0a\x16\x0e\x13\xe3\x01\xce\x65\xea\x47\xc3\xb1\x12\xbb\xbf\x01\x00\x00\xff\xff\xd7\x01\xa8\x37\x87\x04\x00\x00")
|
||
|
|
||
|
func helpTxtBytes() ([]byte, error) {
|
||
|
return bindataRead(
|
||
|
_helpTxt,
|
||
|
"help.txt",
|
||
|
)
|
||
|
}
|
||
|
|
||
|
func helpTxt() (*asset, error) {
|
||
|
bytes, err := helpTxtBytes()
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
info := bindataFileInfo{name: "help.txt", size: 1159, mode: os.FileMode(420), modTime: time.Unix(1463914687, 0)}
|
||
|
a := &asset{bytes: bytes, info: info}
|
||
|
return a, nil
|
||
|
}
|
||
|
|
||
|
// Asset loads and returns the asset for the given name.
|
||
|
// It returns an error if the asset could not be found or
|
||
|
// could not be loaded.
|
||
|
func Asset(name string) ([]byte, error) {
|
||
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||
|
if f, ok := _bindata[cannonicalName]; ok {
|
||
|
a, err := f()
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
|
||
|
}
|
||
|
return a.bytes, nil
|
||
|
}
|
||
|
return nil, fmt.Errorf("Asset %s not found", name)
|
||
|
}
|
||
|
|
||
|
// MustAsset is like Asset but panics when Asset would return an error.
|
||
|
// It simplifies safe initialization of global variables.
|
||
|
func MustAsset(name string) []byte {
|
||
|
a, err := Asset(name)
|
||
|
if err != nil {
|
||
|
panic("asset: Asset(" + name + "): " + err.Error())
|
||
|
}
|
||
|
|
||
|
return a
|
||
|
}
|
||
|
|
||
|
// AssetInfo loads and returns the asset info for the given name.
|
||
|
// It returns an error if the asset could not be found or
|
||
|
// could not be loaded.
|
||
|
func AssetInfo(name string) (os.FileInfo, error) {
|
||
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||
|
if f, ok := _bindata[cannonicalName]; ok {
|
||
|
a, err := f()
|
||
|
if err != nil {
|
||
|
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
|
||
|
}
|
||
|
return a.info, nil
|
||
|
}
|
||
|
return nil, fmt.Errorf("AssetInfo %s not found", name)
|
||
|
}
|
||
|
|
||
|
// AssetNames returns the names of the assets.
|
||
|
func AssetNames() []string {
|
||
|
names := make([]string, 0, len(_bindata))
|
||
|
for name := range _bindata {
|
||
|
names = append(names, name)
|
||
|
}
|
||
|
return names
|
||
|
}
|
||
|
|
||
|
// _bindata is a table, holding each asset generator, mapped to its name.
|
||
|
var _bindata = map[string]func() (*asset, error){
|
||
|
"help.txt": helpTxt,
|
||
|
}
|
||
|
|
||
|
// AssetDir returns the file names below a certain
|
||
|
// directory embedded in the file by go-bindata.
|
||
|
// For example if you run go-bindata on data/... and data contains the
|
||
|
// following hierarchy:
|
||
|
// data/
|
||
|
// foo.txt
|
||
|
// img/
|
||
|
// a.png
|
||
|
// b.png
|
||
|
// then AssetDir("data") would return []string{"foo.txt", "img"}
|
||
|
// AssetDir("data/img") would return []string{"a.png", "b.png"}
|
||
|
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
|
||
|
// AssetDir("") will return []string{"data"}.
|
||
|
func AssetDir(name string) ([]string, error) {
|
||
|
node := _bintree
|
||
|
if len(name) != 0 {
|
||
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||
|
pathList := strings.Split(cannonicalName, "/")
|
||
|
for _, p := range pathList {
|
||
|
node = node.Children[p]
|
||
|
if node == nil {
|
||
|
return nil, fmt.Errorf("Asset %s not found", name)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if node.Func != nil {
|
||
|
return nil, fmt.Errorf("Asset %s not found", name)
|
||
|
}
|
||
|
rv := make([]string, 0, len(node.Children))
|
||
|
for childName := range node.Children {
|
||
|
rv = append(rv, childName)
|
||
|
}
|
||
|
return rv, nil
|
||
|
}
|
||
|
|
||
|
type bintree struct {
|
||
|
Func func() (*asset, error)
|
||
|
Children map[string]*bintree
|
||
|
}
|
||
|
var _bintree = &bintree{nil, map[string]*bintree{
|
||
|
"help.txt": &bintree{helpTxt, map[string]*bintree{}},
|
||
|
}}
|
||
|
|
||
|
// RestoreAsset restores an asset under the given directory
|
||
|
func RestoreAsset(dir, name string) error {
|
||
|
data, err := Asset(name)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
info, err := AssetInfo(name)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// RestoreAssets restores an asset under the given directory recursively
|
||
|
func RestoreAssets(dir, name string) error {
|
||
|
children, err := AssetDir(name)
|
||
|
// File
|
||
|
if err != nil {
|
||
|
return RestoreAsset(dir, name)
|
||
|
}
|
||
|
// Dir
|
||
|
for _, child := range children {
|
||
|
err = RestoreAssets(dir, filepath.Join(name, child))
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
}
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func _filePath(dir, name string) string {
|
||
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||
|
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
||
|
}
|
||
|
|