putingh

package module
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 19 Imported by: 1

README

putingh (Put in GH)

Put file in the GH

Go Report Card GoDoc GitHub license

Usage

# Put file in git repository
GH_TOKEN=you_github_token putingh git://owner/repository/branch/name[/name]... localfile

# Put file in git repository release assets
GH_TOKEN=you_github_token putingh asset://owner/repository/release/name localfile

# Put file in gist
GH_TOKEN=you_github_token putingh gist://owner/gist_id/name localfile

# Get file from git repository
GH_TOKEN=you_github_token putingh git://owner/repository/branch/name[/name]...

# Get file from git repository release assets
GH_TOKEN=you_github_token putingh asset://owner/repository/release/name

# Get file from gist
GH_TOKEN=you_github_token putingh gist://owner/gist_id/name

Example

wzshiming/action-upload-release-assets

License

Licensed under the MIT License. See LICENSE for the full license text.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultOptions = []Option{
		WithHost("https://github.com"),
		WithGitAuthorSignature("bot", ""),
		WithTmpDir("./tmp/"),
		WithOutput(io.Discard),
		WithPerPage(100),
		WithContext(context.Background()),
		WithGitCommitMessage(func(owner, repo, branch, name, path string) string {
			return fmt.Sprintf("Automatic update %s", name)
		}),
	}

	ErrNotFound = fmt.Errorf("not found")
)

Functions

This section is empty.

Types

type Option added in v0.5.0

type Option func(p *PutInGH)

func WithContext added in v0.5.0

func WithContext(ctx context.Context) Option

func WithGitAuthorSignature added in v0.5.0

func WithGitAuthorSignature(username, email string) Option

func WithGitCommitMessage added in v0.5.0

func WithGitCommitMessage(fn func(owner, repo, branch, name, path string) string) Option

func WithGitCommitOptions added in v0.5.0

func WithGitCommitOptions(fn func(owner, repo, branch, name, path string) (opt *gogit.CommitOptions)) Option

func WithHTTPClient added in v0.5.1

func WithHTTPClient(fun func(cli *http.Client) *http.Client) Option

func WithHost added in v0.5.0

func WithHost(host string) Option

func WithOutput added in v0.5.0

func WithOutput(out io.Writer) Option

func WithPerPage added in v0.5.0

func WithPerPage(perPage int) Option

func WithTmpDir added in v0.5.0

func WithTmpDir(dir string) Option

type PutInGH

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

func NewPutInGH

func NewPutInGH(token string, options ...Option) *PutInGH

func (*PutInGH) GetFrom added in v0.4.0

func (s *PutInGH) GetFrom(ctx context.Context, uri string) (io.Reader, error)

func (*PutInGH) GetFromGist added in v0.4.0

func (s *PutInGH) GetFromGist(ctx context.Context, owner, gistId, name string) (io.Reader, error)

func (*PutInGH) GetFromGit added in v0.4.0

func (s *PutInGH) GetFromGit(ctx context.Context, owner, repo, branch, name string) (io.Reader, error)

func (*PutInGH) GetFromReleasesAsset added in v0.4.0

func (s *PutInGH) GetFromReleasesAsset(ctx context.Context, owner, repo, release, name string) (io.Reader, error)

func (*PutInGH) PutIn added in v0.2.0

func (s *PutInGH) PutIn(ctx context.Context, uri string, r io.Reader) (string, error)

func (*PutInGH) PutInWithFile added in v0.2.0

func (s *PutInGH) PutInWithFile(ctx context.Context, uri, filename string) (string, error)

Directories

Path Synopsis
cmd
putingh command

Jump to

Keyboard shortcuts

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