yubs

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 5 Imported by: 0

README

YUbS

codebeat badge Go Report Card Coverage Status

icontouka

コマンドラインで入力したURLを短縮URLにする。

概要

Bit.lyは入力したURLを短縮URLにできるWebapiのサービスであるが、

サイトに移動しURLを入力してなどするとすこし面倒である。

そこでCLIでBit.lyを利用することでよりスムーズにURLを短縮できるようにした。

Usage

Command references

 Usage yubs [OPTION] [URL]  
 OPTION:
 -t, --token [TOKEN]    bitlyのアクセストークンを指定する。
 -h, --help            ヘルプメッセージを表示する。
 -v, --version         versionを表示する。
 ARGUMENT
 URL     コマンドラインで入力したURLを短縮URLにする。

インストール方法

 brew install yubs 

このプロジェクトについて

開発者 : NishioSoichiro

使用言語:GO

ライセンス : GitHub

アイコン:

icontouka

名前の由来 : 「Your URL be shorter(あなたのURLをより短くする)」の英語の単語の頭文字をそれぞれ取り出した。すこし造語っぽいが覚えやすいのではないかと思いこの名前とした。

バージョン : 0.0.0 2023/4/18

GitHub Github GitHub GitHub GitHub

website:https://soichiro-nishio-github.github.io/yubs/

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitly

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

func NewBitly

func NewBitly(group string) *Bitly

func (*Bitly) Groups

func (bitly *Bitly) Groups(config *Config) ([]*Group, error)

func (*Bitly) List

func (bitly *Bitly) List(config *Config) ([]*ShortenUrl, error)

func (*Bitly) Shorten

func (bitly *Bitly) Shorten(config *Config, url string) (*ShortenUrl, error)

正常に動作するとここがうごく

type Config

type Config struct {
	Token   string
	RunMode Mode
}

func NewConfig

func NewConfig(token string, mode Mode) *Config

type Group

type Group struct {
	Guid     string `json:"guid"`
	IsActive bool   `json:"is_active"`
}

type Mode

type Mode int
const (
	Shorten Mode = iota + 1
	List
	ListGroup
	Delete
	QRCode
)

func (Mode) String

func (m Mode) String() string

type ShortenUrl

type ShortenUrl struct {
	Shorten   string `json:"link"`
	Original  string `json:"long_url"`
	IsDeleted bool   `json:"is_deleted"`
	Group     string
}

func (*ShortenUrl) String

func (surl *ShortenUrl) String() string

type URLShortener

type URLShortener interface {
	List(config *Config) ([]*ShortenUrl, error)
	Shorten(config *Config, url string) (*ShortenUrl, error)
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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