gist

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2016 License: MIT Imports: 8 Imported by: 0

README

gist-cli

Go Report Card

中文 | English

安装

go get -u -v github.com/xuqingfeng/gist-cli/cmd/gist

或者直接下载 二进制文件

用法

gist -u=YOUR_USERNAME -t=YOUR_TOKEN -d=DESCRIPTION FILE0 FILE1

或者导出环境变量

# vi ~/.zshrc (.bashrc ...)
# gist
export GIST_CLI_USERNAME="YOUR_USERNAME"
export GIST_CLI_TOKEN="YOUR_TOKEN"
export GIST_CLI_PROXY="YOUR_SOCKS5_PROXY" # socks5://localhost:9742

gist FILE0 FILE1

其他

gist -h 列出所有命令

Documentation

Index

Constants

View Source
const (
	// GIST_API_URL holds github gist api url
	GIST_API_URL = "https://api.github.com/gists"

	// ENV
	GIST_CLI_USERNAME = "GIST_CLI_USERNAME"
	GIST_CLI_TOKEN    = "GIST_CLI_TOKEN"
	GIST_CLI_PROXY    = "GIST_CLI_PROXY"
)

Variables

View Source
var (
	ErrNoUsername = errors.New("no username provided")
	ErrNoToken    = errors.New("no token provided")
	ErrNoFiles    = errors.New("no file provided")
)

Functions

func Paste

func Paste(anonymous, public bool, username, token, description, proxyCfg string, flagArgs []string) error

Paste is used to upload files to gist.github.com upload empty files will return error

Types

type Data

type Data struct {
	Files       map[string]File `json:"files"`
	Description string          `json:"description"`
	Public      bool            `json:"public"`
}

Data holds client post params

type ErrRet

type ErrRet struct {
	Message string `json:"message"`
}

ErrRet holds github error return

type File

type File struct {
	Content string `json:"content"`
}

File is part of Data

type Ret

type Ret struct {
	Id          string `json:"id"`
	Url         string `json:"url"`
	HtmlUrl     string `json:"html_url"`
	Description string `json:"description"`
	Public      bool   `json:"public"`
}

Ret holds github success return

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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