gol

command module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2018 License: MIT Imports: 5 Imported by: 0

README

gol

gol(go link) is a url shortner that run in cli and browser.

Build Status Go Report Card

sample/ui.png

Install

To install, use go get or dockerhub

$ go get github.com/matsu-chara/gol

Usage

you can use gol as a server or cli

server
# run server at localhost:5656
$ gol server

# or run in background and restart always
$ docker-compose up -d

http://localhost:5656/ will show link list and some form for registering or deleting.

API
dump

access http://localhost:5656/api/dump dumps all links.

sample/gol_chrome1.png

get

access http://localhost:5656/${key} will return redirect response destinating to the ${value}

put

curl -X PUT -d value=${some_url} http://localhost:5656/${key}" will add a link to key

curl -X PUT -d "value=${some_url}&force=true" http://localhost:5656/${key} will add a link to key (if replace key when conflict)

curl -X PUT -d "value=${some_url}&registeredBy=bar" http://localhost:5656/${key} will add a link to key with a registeredBy "bar".

delete

curl -X DELETE http://localhost:5656/${key} delete a link

curl -X DELETE http://localhost:5656/${key}?registeredBy=bar delete a link which have registerdBy=bar. (if registeredBy is not equal to the server data, request will fail.)

setting chrome

Open Chrome > Preference > add Search Engine > add below

- name: gol
- keyword: gol
- query: http://localhost:5656/%s

then, you can open gol links by click url bar > type 'gol' > tab > type key > enter

type gol > tab > type key sample/gol_chrome2.png

then enter > jump to the link sample/gol_chrome3.png

As a further advanced usage, you can set custom name space.

example 1. env specific links.

- name: gop
- keyword: gop
- query: http://localhost:5656/production_%s

example 2. my original links. (prevent contamination of the global namespace)

- name: gom
- keyword: gom
- query: http://localhost:5656/matsu_chara_%s
in cli

sample/gol_cli.gif

usage
$ gol add confluence https://confluence.nice-company.com
$ gol add myproduct https://github.nice-company.com/myteam/myproduct
$ gol add myteamdocs https://confluence.nice-company.com/pages/viewpage.action?pageId=xxxxxxx
$ gol add jenkins_dev https://dev.jenkins.nice-company.com/
$ gol add jenkins_prod https://dev.jenkins.nice-company.com/
$ gol add consul_prod https://our-server01:8500/
$ gol add myproduct_admin_prod https://our-server02:9534

$ gol ls
confluence: https://confluence.nice-company.com
consul_prod: https://our-server01:8500/
jenkins_dev: https://dev.jenkins.nice-company.com/
jenkins_prod: https://dev.jenkins.nice-company.com/
myproduct: https://github.nice-company.com/myteam/myproduct
myproduct_admin_prod: https://our-server02:9534
myteamdocs: https://confluence.nice-company.com/pages/viewpage.action?pageId=xxxxxxx

$ gol get jenkins_dev
https://dev.jenkins.nice-company.com/

$ gol rm consul_prod
$ gol get consul_prod
zsh completion

https://gist.github.com/3tty0n/0ef541bb9fce758c4c064ce96ba83a91

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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