dachsurl

package module
v0.1.39 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

README

dachsurl

URL短縮ツール(開発中) 🥺

build Coverage Status codebeat badge Go Report Card

GitHub Version

概要

CLIによるシンプルなURL短縮ツール。 入力した冗長なURLをダックスフントの足のように短くします。 URLや足を長くしたいというご要望にはお応えできません。

公式ドキュメント

アイコン ボタンをクリックすると、公式ドキュメントへ移動します。

使用方法

Usage:
  dachsurl [OPTIONS] [URLs...]

OPTIONS
    -t, --token <TOKEN>      bit.lyのトークンを指定します. (必須オプション)
    -c, --clipboard          短縮URLをクリップボードに出力します.
    -d, --delete             指定した短縮URLを削除します.
    -h, --help               このメッセージを表示し、終了します.
    -v, --version            バージョンを表示し、終了します.
ARGUMENT
    URL     URLは短縮用のURLを指定します。この引数は複数指定できます.
            引数が指定されていない場合、dachsurlは利用可能な短縮URLのリストを表示します.

※ 「-c, --clipboard」オプションを指定した状態で、複数URLを指定すると、一番最後のURLがクリップボードにコピーされます.

インストール方法

Docker
docker pull ghcr.io/practicet/dachsurl:latest

docker run -it --rm ghcr.io/practicet/dachshurl:latest -t <token> <url...>

プロジェクトについて

開発者

HAYASHI Tomokazu

ライセンス

Apache License 2.0

Permissions
Commercial use
Modification
Distribution
Patent use
Private use
Limitations
Trademark use
Liability
Warranty
Conditions
License and copyright notice
State changes
アイコン
アイコン アイコン
アイコン アイコン
アイコン アイコン
名前の由来

URLをダックスフント(Dachshund)の足のように短くするという由来です。

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) Delete

func (bitly *Bitly) Delete(config *Config, shortenURL string) error

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
	Delete
)

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)
	Delete(config *Config, shortenURL string) error
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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