Home
Softono

Kutt Go

Open source MIT Go
20
Stars
4
Forks
0
Issues
2
Watchers
3 years
Last Commit

 About Kutt Go

Kutt.it API client & CLI written in Go

Platforms

Web Self-hosted

Languages

Go

Links

Need Help Installing Kutt Go?

We provide expert installation service for this software. Our team will install, configure, and secure Kutt Go on your server. plans start at just $30.

kutt-go

Kutt.it API Client for Go and CLI tool

Kutt.it is a Modern Open Source URL shortener.

  • Custom domain
  • Password for the URL
  • Managing links
  • Free & Open Source
  • 50 URLs shortening per day.

This repo contains a CLI and golang package for the service.

CLI

Installation

$ go install github.com/raahii/kutt-go/cmd/kutt@latest

Usage

$ kutt register <your api key>
$ kutt submit <url to shorten>
https://kutt.it/ztPDmK
❯ kutt --help
CLI tool for Kutt.it (URL Shortener)

Usage:
  kutt [command]

Available Commands:
  apikey      Register your api key to cli
  delete      Delete a shorted link (Give me url id or url shorted)
  list        List of last 5 URL objects.
  submit      Submit a new short URL
  help        Help about any command

Flags:
  -k, --apikey string   api key for Kutt.it
  -h, --help            help for kutt

Use "kutt [command] --help" for more information about a command.

Go Package

Installation

$ go get -u github.com/raahii/kutt-go

Example

This is a example to get shorter url. See also codes in _example directory.

package main

import (
	"fmt"
	"log"

	"github.com/raahii/kutt-go"
)

func main() {
	cli := kutt.NewClient("<api key>")

	// create a short url
	target := "https://github.com/raahii/kutt-go"
	URL, err := cli.Submit(
		target,
		// kutt.WithCustomURL("kutt-go"),
		// kutt.WithPassword("foobar"),
		// kutt.WithReuse(true),
	)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(URL.ShortURL) // https://kutt.it/kutt-go
}
type URL struct {
	ID         string    `json:"id"`
	Target     string    `json:"target"`
	ShortURL   string    `json:"shortUrl"`
	Password   bool      `json:"password"`
	Reuse      bool      `json:"reuse"`
	DomainID   string    `json:"domain_id"`
	VisitCount int       `json:"visit_count"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

Reference

Licence

Code released under the MIT License.