copy

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: MIT, MIT Imports: 7 Imported by: 0

README

copy

file copy install package

  • use http.FileSystem interface

Installation

$ go get github.com/gnue/inst/pkgs/copy

Usage

import "github.com/gnue/inst/pkgs/copy"

Examples

Install
package main

import (
	"fmt"
	"github.com/gnue/inst"
	"net/http"
)

func main() {
	fs := copy.New(http.Dir("source"), "/")
	fname, err := fs.Install("target", inst.Local, true)
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Printf("copy %q\n", fname)
	}
}

install bash-completion file

Uninstall
package main

import (
	"fmt"
	"github.com/gnue/inst"
	"net/http"
)

func main() {
	fs := copy.New(http.Dir("source"), "/")
	fname, err := fs.Uninstall("target", inst.Local)
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Printf("remove %q\n", fname)
	}
}

uninstall bash-completion file

Author

gnue

License

MIT

Documentation

Overview

file copy install package

* use http.FileSystem interface

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileSystem

type FileSystem struct {
	http.FileSystem
	// contains filtered or unexported fields
}

func New

func New(fs http.FileSystem, root string) *FileSystem

func (*FileSystem) Execute

func (fs *FileSystem) Execute(w io.Writer, data interface{}) (err error)

func (*FileSystem) Install

func (fs *FileSystem) Install(dir string, loc inst.Locate, force bool) (string, error)

func (*FileSystem) Open

func (fs *FileSystem) Open(name string) (http.File, error)

func (*FileSystem) Uninstall

func (fs *FileSystem) Uninstall(dir string, loc inst.Locate) (string, error)

Jump to

Keyboard shortcuts

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