sync

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoSync

func AutoSync(file string) error

AutoSync syncs snippets automatically

Types

type Client added in v0.3.1

type Client interface {
	GetSnippet() (*Snippet, error)
	UploadSnippet(string) error
}

Client manages communication with the remote Snippet repository

func NewGistClient added in v0.3.1

func NewGistClient() (Client, error)

NewGistClient returns GistClient

func NewGitLabClient added in v0.3.1

func NewGitLabClient() (Client, error)

NewGitLabClient returns GitLabClient

func NewSyncClient added in v0.3.1

func NewSyncClient() (Client, error)

NewSyncClient returns Client

type GistClient added in v0.3.1

type GistClient struct {
	Client *github.Client
	ID     string
}

GistClient manages communication with Gist

func (GistClient) GetSnippet added in v0.3.1

func (g GistClient) GetSnippet() (*Snippet, error)

GetSnippet returns the remote snippet

func (GistClient) UploadSnippet added in v0.3.1

func (g GistClient) UploadSnippet(content string) error

UploadSnippet uploads local snippets to Gist

type GitLabClient added in v0.3.1

type GitLabClient struct {
	Client *gitlab.Client
	ID     int
}

GitLabClient manages communication with GitLab Snippets

func (GitLabClient) GetSnippet added in v0.3.1

func (g GitLabClient) GetSnippet() (*Snippet, error)

GetSnippet returns the remote snippet

func (GitLabClient) UploadSnippet added in v0.3.1

func (g GitLabClient) UploadSnippet(content string) error

UploadSnippet uploads local snippets to GitLab Snippet

type Snippet added in v0.3.1

type Snippet struct {
	Content   string
	UpdatedAt time.Time
}

Snippet is the remote snippet

Jump to

Keyboard shortcuts

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