UrlShortener-go

module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: MIT

README

URL Shortener (Go)

A URL shortener command-line app. for bit.ly. Implemented in Go, using bit.ly's API v4.

You can use it in interactive mode only.

Installation

$ go install github.com/jabbalaci/UrlShortener-go/cmd/urlshortener@latest

It was tested under Linux and Windows.

Pre-requisite

For this to work, you need an access token from bit.ly. Don't worry, it's free. After registration you can generate one for yourself. Then, add it as an environment variable called BITLY_ACCESS_TOKEN. For instance, under Linux add the following line to the end of your ~/.bashrc file:

export BITLY_ACCESS_TOKEN="..."

Under Linux, the copy to clipboard functionality requires the Linux command xsel. You can install it via your package manager.

Usage

$ urlshortener
Long URL: https://github.com/jabbalaci/UrlShortener-go

https://bit.ly/41dBYWh

# expanded from shortened URL: https://github.com/jabbalaci/UrlShortener-go (matches)

Copy shortened URL to clipboard [Yn]? y
# copied ✓
Zoom into this short URL [yN]? y
# yes ✓
# written to /tmp/urlshortener-1795634551.html

Provide the long URL, and it'll give you back the shortened bit.ly URL.

If you want, you can copy the short URL to the clipboard.

If you want, you can create a local HTML file that shows the short URL using large fonts. This is useful if you do a presentation / lecture and you quickly want to share a link with your audience.

Screenshot of the local HTML page:

screenshot

The characters in the funny ID are also pronounced to avoid confusion between similar characters like o, O, 0, etc.

In addition, there's also a QR code pointing on your URL.

Directories

Path Synopsis
cmd
examples
lib
jconsole
Console / terminal related functions.
Console / terminal related functions.
jconsole/fancy
Reading from stdin with readline support.
Reading from stdin with readline support.
jos

Jump to

Keyboard shortcuts

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