sync

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2019 License: MIT Imports: 13 Imported by: 0

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

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

Client manages communication with the remote Snippet repository

func NewGistClient

func NewGistClient() (Client, error)

NewGistClient returns GistClient

func NewGitLabClient

func NewGitLabClient() (Client, error)

NewGitLabClient returns GitLabClient

func NewSyncClient

func NewSyncClient() (Client, error)

NewSyncClient returns Client

type GistClient

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

GistClient manages communication with Gist

func (GistClient) GetSnippet

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

GetSnippet returns the remote snippet

func (GistClient) UploadSnippet

func (g GistClient) UploadSnippet(content string) error

UploadSnippet uploads local snippets to Gist

type GitLabClient

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

GitLabClient manages communication with GitLab Snippets

func (GitLabClient) GetSnippet

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

GetSnippet returns the remote snippet

func (GitLabClient) UploadSnippet

func (g GitLabClient) UploadSnippet(content string) error

UploadSnippet uploads local snippets to GitLab Snippet

type Snippet

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