parrot

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: MIT Imports: 9 Imported by: 0

README

Parrot

Parrot is a Go module that retrieves and loads a file from a remote git repository and copies it into a defined directory.

Installation

To install the package run

go get -u github.com/asccigcc/parrot

Usage

This packages is oriented to just dowload files from a specific directory.

package main

import (
    "github.com/asccigcc/parrot"
)

func main() {
    var token string = "GITHUB_TOKEN"
    var repo string = "github.com/username/repository"
    var branch string = "master"

    parrot := parrot.NewParrot(repo, branch, token)

	parrot.FetchDir("/path/to/directory")
	parrot.MoveToLocal("dir_destiny")

	parrot.FetchDir("/directory")
	parrot.MoveToLocal("dir_destiny"))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(token string, ctx context.Context) *http.Client

func OpenFile

func OpenFile(fs http.FileSystem, folder string) string

Types

type Parrot

type Parrot struct {
	// contains filtered or unexported fields
}

func NewParrot

func NewParrot(repo string, branch string, token string) *Parrot

func (*Parrot) FetchDir

func (r *Parrot) FetchDir(dir string) http.FileSystem

Return a FileSystem function if the path is correct

func (*Parrot) MoveToLocal

func (r *Parrot) MoveToLocal(local_dir string)

Directories

Path Synopsis
example
internal

Jump to

Keyboard shortcuts

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